fix: FileUrl doesn't handle Snippets
This commit is contained in:
parent
ae61abe80d
commit
d37cd047e3
3 changed files with 13 additions and 6 deletions
|
|
@ -9,6 +9,7 @@
|
||||||
- fix: Indent Navigation broken (Wouter van Oijen / ProcoliX)
|
- fix: Indent Navigation broken (Wouter van Oijen / ProcoliX)
|
||||||
- fix: HttpProxy not working (with fix) (Eric Kennedy)
|
- fix: HttpProxy not working (with fix) (Eric Kennedy)
|
||||||
- fix: Copyright on Default Template (Wouter van Oijen / ProcoliX)
|
- fix: Copyright on Default Template (Wouter van Oijen / ProcoliX)
|
||||||
|
- fix: FileUrl macro doesn't handle snippets (Wouter van Oijen / ProcoliX)
|
||||||
|
|
||||||
|
|
||||||
7.0.2
|
7.0.2
|
||||||
|
|
|
||||||
|
|
@ -43,13 +43,19 @@ sub process {
|
||||||
my $session = shift;
|
my $session = shift;
|
||||||
my $url = shift;
|
my $url = shift;
|
||||||
my $asset = WebGUI::Asset->newByUrl($session,$url);
|
my $asset = WebGUI::Asset->newByUrl($session,$url);
|
||||||
if (defined $asset) {
|
if (not defined $asset) {
|
||||||
my $storage = WebGUI::Storage->get($session,$asset->get("storageId"));
|
$session->errorHandler->warn("^FileUrl($url): asset not found");
|
||||||
return $storage->getUrl($asset->get("filename"));
|
|
||||||
} else {
|
|
||||||
my $i18n = WebGUI::International->new($session, 'Macro_FileUrl');
|
my $i18n = WebGUI::International->new($session, 'Macro_FileUrl');
|
||||||
return $i18n->get('invalid url');
|
return $i18n->get('invalid url');
|
||||||
}
|
}
|
||||||
|
my $storageId = $asset->get('storageId');
|
||||||
|
if (not defined $storageId) {
|
||||||
|
$session->errorHandler->warn("^FileUrl($url): asset is not a file");
|
||||||
|
my $i18n = WebGUI::International->new($session, 'Macro_FileUrl');
|
||||||
|
return $i18n->get('invalid url');
|
||||||
|
}
|
||||||
|
my $storage = WebGUI::Storage->get($session,$storageId);
|
||||||
|
return $storage->getUrl($asset->get("filename"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -16,9 +16,9 @@ our $I18N = {
|
||||||
message => q|
|
message => q|
|
||||||
<p><b>^FileUrl</b>();<br />
|
<p><b>^FileUrl</b>();<br />
|
||||||
<b>^FileUrl</b>(<i>Asset URL</i>);<br />
|
<b>^FileUrl</b>(<i>Asset URL</i>);<br />
|
||||||
This macro is used to return a filesystem URL to an File, Image or Snippet Asset identified by its Asset URL.</p>
|
This macro is used to return a filesystem URL to a File or Image Asset identified by its Asset URL.</p>
|
||||||
|,
|
|,
|
||||||
lastUpdated => 1146679314,
|
lastUpdated => 1153476000,
|
||||||
},
|
},
|
||||||
|
|
||||||
'invalid url' => {
|
'invalid url' => {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue