You are here: Foswiki>Tasks Web>Item10944 (03 Jan 2016, JozefMojzis)Edit Attach

Item10944: Item10581 broke links to images when publishing

Priority: Urgent
Current State: Closed
Released In: n/a
Target Release: n/a
Applies To: Extension
Component: PublishPlugin
Reported By: MichaelTempest
Waiting For:
Last Change By: JozefMojzis
Item10581 broke links to images in the output of PublishPlugin.

The problem is the call to File::Spec->abs2rel in _rsrcpath() in

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

Topic revision: r3 - 03 Jan 2016, JozefMojzis - This page was cached on 21 Feb 2018 - 02:27.

The copyright of the content on this website is held by the contributing authors, except where stated elsewhere. See Copyright Statement. Creative Commons License