Item10944: Item10581 broke links to images when publishing
Priority: Urgent
Current State: Closed
Released In: n/a
Target Release: n/a
Item10581 broke links to images in the output of
PublishPlugin.
The problem is the call to
File::Spec->abs2rel
in
_rsrcpath()
in
Publisher.pm
.
In my case,
$rsrcloc
was
rsrc/Sandbox/Jomo/CommentTest/za.png
and
$odir
was
/Sandbox
.
abs2rel
returned
../home/config/wiki/foswiki_1x06/bin/rsrc/Sandbox/Jomo/CommentTest/za.png
.
This is consistent with the documentation for
abs2rel
, which says
If $path
is relative, it is converted to absolute form using rel2abs(). This means that it is taken to be relative to cwd().
I found I could make this work by temporarily
chdir
-ing to
/
for the call to
abs2rel
, but I doubt if that is an acceptable solution.
I could also make it work by prefixing
$rsrcloc
with
/
if it didn't already start with
/
. Maybe a better solution would use
File::Spec->file_name_is_absolute
, but I haven't tried that.
Both of the solutions I tried gave the correct result, which is
../rsrc/Sandbox/Jomo/CommentTest/za.png
--
MichaelTempest - 06 Jul 2011
No need to chdir, it's enough to remove the leading / from the
$odir
.
--
CrawfordCurrie - 04 Aug 2011