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 954 karma points
    Jun 24, 2015 @ 01:05
    Tom
    0

    BUG- PhysicalFileSystemProvider doesn't allow virtual folders outside web folder any more

    Hi All, We use a virtual media folder in our current implementation of v6. We have upgraded to 7.2.5 and it fails because httpcontext is null.. HttpContext.Current will always be null when uploading media

    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??

    I understand it's helpful if running from a console app but could you have the same intent using

    if (useHttpContext && (HttpRuntime.AppDomainAppId != null || HttpContext.Current != 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

Please Sign in or register to post replies

Write your reply to:

Draft