Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Tom 713 posts 952 karma points
    Jun 24, 2015 @ 00:22
    Tom
    0

    Regression from umbraco 6 for virtual media folders

    Hi All, We use a virtual media folder in our current implementation of v6. We have upgraded to 7.2.4 and it fails because httpcontext is null..

    In line 92 of IOHelper.cs you see the following code

      if (useHttpContext && HttpContext.Current != null)
            {
                //string retval;
                if (string.IsNullOrEmpty(path) == false && (path.StartsWith("~") || path.StartsWith(SystemDirectories.Root)))
                    return System.Web.Hosting.HostingEnvironment.MapPath(path);
                else
                    return System.Web.Hosting.HostingEnvironment.MapPath("~/" + path.TrimStart('/'));
            }
    

    Why do they even need the HttpContext.Current != null check here as MapPath will still work even if the HttpContext.Current is null??

    Should I be writing a work around in a custom version of PhysicalFileSystem from Core.IO or will this be fixed soonish?

    Thanks, Tom

  • Robert Foster 440 posts 1684 karma points MVP admin c-trib
    Jun 24, 2015 @ 00:36
    Robert Foster
    0

    My suggestion would be to put this on the issue tracker and maybe submit a pull request against it - most likely to get a dialog happening on this with the Core team....

  • Tom 713 posts 952 karma points
    Jun 24, 2015 @ 00:49
    Tom
    0

    Thanks will do that now :)

    Where is the issue tracker? GitHub's issues appear to be read only? I posted in our.umbraco.org bugs is that the correct spot?

  • Tom Fulton 2030 posts 4996 karma points c-trib
    Jun 24, 2015 @ 03:00
    Tom Fulton
    0

    Hi Tom,

    Sorry for the confusion, the issue tracker is here and is a better place to report bugs: http://issues.umbraco.org

    I'm curious what problems you're running into, though? On a 7.1.6 install (code looks the same), we're able to run /media/ as a virtual directory that points to a file share via UNC, and doesn't seem to have any problems.

    -Tom

  • Tom 713 posts 952 karma points
    Jun 24, 2015 @ 03:10
    Tom
    0

    Hi Tom, UNC paths are fine. It's when you want to step outside the web root to resolve something like ~/media

    because HttpContext.Current is null in the media section of the umbraco admin when you upload a file, you never get this line hit:

    if (string.IsNullOrEmpty(path) == false && (path.StartsWith("~") || path.StartsWith(SystemDirectories.Root)))
                return System.Web.Hosting.HostingEnvironment.MapPath(path);
    

    So it means that the file gets uploaded to

  • This forum is in read-only mode while we transition to the new forum.

    You can continue this topic on the new forum by tapping the "Continue discussion" link below.

Please Sign in or register to post replies