PictureService uses HttpContext.Current, risk of NullReferenceException

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.
12 anos atrás
In nop 2.1, the properties LocalThumbImagePath and LocalImagePath both call HttpContext.Current to get the physical path. However, if the picture service is used in for instance a task, HttpContext.Current is null and getting the physical path will throw a NullReferenceException. A better way to do this is to call HttpRuntime.AppDomainAppPath
12 anos atrás
Thanks!
12 anos atrás
This problem is still there in nop 2.3. It doesn't throw NullReferenceException but NotImplementedException
12 anos atrás
Thanks for info. I'll create a work item
12 anos atrás
[email protected] wrote:
A better way to do this is to call HttpRuntime.AppDomainAppPath

Just found that HttpRuntime.AppDomainAppPath cannot be used in unit tests. I think it should be wrapper to some class, such as IWebHelper.
12 anos atrás
See changeset de44d5f7de13. Please let me know if it works fine now
12 anos atrás
a.m. wrote:
See changeset de44d5f7de13. Please let me know if it works fine now

Seems to work now, thanks a lot!
This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.