diff --git a/docs/changelog/7.x.x.txt b/docs/changelog/7.x.x.txt index 739254602..05f18730f 100644 --- a/docs/changelog/7.x.x.txt +++ b/docs/changelog/7.x.x.txt @@ -17,6 +17,8 @@ - Fixed typo in template variable project.gantt.rowspan and documentation - fix: Events Calendar Double Date (Wouter van Oijen / ProcoliX) - fix: Data Form Text Area Box Non-Existent (Wouter van Oijen / ProcoliX) + - Added an error message to the FileUrl macro to help users figure out why it + doesn't work. 7.0.2 diff --git a/lib/WebGUI/Macro/FileUrl.pm b/lib/WebGUI/Macro/FileUrl.pm index 1890c0648..13f87eddf 100644 --- a/lib/WebGUI/Macro/FileUrl.pm +++ b/lib/WebGUI/Macro/FileUrl.pm @@ -50,9 +50,14 @@ sub process { } my $storageId = $asset->get('storageId'); if (not defined $storageId) { - $session->errorHandler->warn("^FileUrl($url): asset is not a file"); + $session->errorHandler->warn("^FileUrl($url): asset does not store files"); return $i18n->get('no storage'); } + my $filename = $asset->get('filename'); + if (not defined $filename) { + $session->errorHandler->warn("^FileUrl($url): asset does not have a 'filename' property"); + return $i18n->get('no filename'); + } my $storage = WebGUI::Storage->get($session,$storageId); return $storage->getUrl($asset->get("filename")); } diff --git a/lib/WebGUI/i18n/English/Macro_FileUrl.pm b/lib/WebGUI/i18n/English/Macro_FileUrl.pm index 43ff9b952..0b9d68f10 100644 --- a/lib/WebGUI/i18n/English/Macro_FileUrl.pm +++ b/lib/WebGUI/i18n/English/Macro_FileUrl.pm @@ -31,6 +31,11 @@ This macro is used to return a filesystem URL to a File or Image Asset identifie lastUpdated => 1153498370, }, + 'no filename' => { + message => q|The Asset you requested does not have a filename property.|, + lastUpdated => 1153618016, + }, + }; 1;