Using image on subfolders causes exception


The module only allows images being in the root folder or on level 1 folder. If you try to select an image on a sub/subfolder it causes an exception:

Error: Media is currently unavailable. DotNetNuke.Services.Exceptions.ModuleLoadException: Value cannot be null. Parameter name: folder ---> System.ArgumentNullException: Value cannot be null. Parameter name: folder at DotNetNuke.Common.Requires.NotNull(String argName, Object argValue) in D:\Projectes\Devel\devel623\Community\Library\Common\Requires.cs:line 79 at DotNetNuke.Services.FileSystem.FileManager.GetFile(IFolderInfo folder, String fileName) in D:\Projectes\Devel\devel623\Community\Library\Services\FileSystem\FileManager.cs:line 460 at DotNetNuke.Modules.Media.MediaController.GetFileFromProvider(Int32 portalId, IFolderInfo oFolder, String fileName) in D:\Projectes\Devel\devel623\website\DesktopModules\Media\Components\MediaController.cs:line 405 at DotNetNuke.Modules.Media.MediaInfo.get_WebFriendlyUrl() in D:\Projectes\Devel\devel623\website\DesktopModules\Media\Entities\MediaInfo.cs:line 415 at DotNetNuke.Modules.Media.MediaMarkUpUtility.GetImageMarkUp(MediaInfo Media, ModuleInfo ModuleConfig) in D:\Projectes\Devel\devel623\website\DesktopModules\Media\Utilities\MarkUpUtility.cs:line 248 at DotNetNuke.Modules.Media.MediaController.DisplayMedia(Int32 moduleId, Int32 tabId, Boolean isEditable, ModuleInfo config, PortalSettings settings) in D:\Projectes\Devel\devel623\website\DesktopModules\Media\Components\MediaController.cs:line 288 at DotNetNuke.Modules.Media.MediaModule.BindData() in D:\Projectes\Devel\devel623\website\DesktopModules\Media\MediaModule.ascx.cs:line 105 at DotNetNuke.Modules.Media.MediaModule.Page_Load(Object sender, EventArgs e) in D:\Projectes\Devel\devel623\website\DesktopModules\Media\MediaModule.ascx.cs:line 89 --- End of inner exception stack trace ---
Closed Feb 10 at 4:17 PM by hismightiness


vmasanas wrote Nov 7, 2012 at 10:56 AM

Error is on this line:

string folderPath = Regex.Match(Src, FILE_PATH_PATTERN).Groups[1].Value;

this will always get on folderPath ONLY the last subfolder, not the whole path.

vmasanas wrote Nov 7, 2012 at 11:00 AM

Changing from:
string folderPath = Regex.Match(Src, FILE_PATH_PATTERN).Groups[1].Value;
string fileName = Regex.Match(Src, FILE_PATH_PATTERN).Groups[2].Value;

string fileName = Regex.Match(Src, FILE_PATH_PATTERN).Groups[2].Value;
string folderPath = Src.Substring(0, Src.Length - fileName.Length);

Solves the issue.

jfarrance wrote Mar 1, 2013 at 7:36 PM

What version was this reported in? I just downloaded and tried v4.04.00 (says Feb 7, 2013) on a DNN 7.00.03 site and encountered this problem right away. Is there a way to implement the code fixes above (vmasanas) without having to use Visual Studio and compile an updated module? Thanks - Jeremy

urgestein wrote Mar 23, 2013 at 12:07 PM

Downloaded module today. Problem still exists.

PokerDIY wrote Aug 18, 2013 at 8:40 PM

FYI: I am using the latest version (August 2013) and this problem renders it unusable

hismightiness wrote Jan 24 at 2:14 PM

This is on my radar now. I'll get it updated soon.