relative image xlink:href export to odg broken

Bug #1793940 reported by Thomas Holder
8
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Inkscape
Fix Released
Undecided
Thomas Holder

Bug Description

Regression of "Export to odg not work in 0.91 and 0.92"
https://bugs.launchpad.net/inkscape/+bug/1654034

Observed on Arch Linux and macOS 10.12

Inkscape versions:
- master branch: 0.92+devel (6bcef54175, 2018-09-21, custom)
- 0.92.x branch: 0.92.3 (549ef9d338, 2018-09-22, custom)

Steps to reproduce:
1) Create SVG with <image> and relative xlink:href (image not in the current directory)
2) File > Save As... > OpenDocument drawing

Result:
- During export, prints "Could not load image file '...'"
- Image missing from ODG file

The fix for bug 1654034 removed the relative link handling logic:
https://gitlab.com/inkscape/inkscape/commit/d61e166a900e32e6f1640c7c26b1a8a66826e51d

Revision history for this message
Thomas Holder (speleo3) wrote :

I think I falsely blamed the bug 1654034 fix, I'm sorry. Reverting the fix doesn't help, and I can reproduce it also with "Inkscape 0.92.2 2405546, 2018-03-11" (from Arch Linux repo).

Revision history for this message
Patrick Storz (ede123) wrote :

Is the relative directory a parent directory or a child directory for you?

On Windows I'm seeing the following behavior:
- If the directory is a child directory a relative xlink:href is stored.
  Embedding the file into ODG works as expected.
- If the directory is a parent directory Inkscape only ever saves an
  absolute xlink:href that looks like 'xlink:href="file:///E:/file.png"'.
  Embedding the file into ODG works as expected.
- If the directory is a parent directory and I manually replace the
  xlink:href with a relative one like 'xlink:href="../file.png"'
  embedding the file into ODG works as expected.

So I'm actually *not* able to reproduce this issue on Windows.

That said I put quite some effort into fixing file lookups on Windows around the time I fixed bug #1654034 as the logic seldomly assumed Windows-style paths to be a possibility and could get a lot of them working (although a few border cases are still problematic).
As I didn't test on any other OS I wouldn't rule out some issues remain for those...

Revision history for this message
Thomas Holder (speleo3) wrote :

Thanks for testing, Patrick!

I'm attaching a simple test case. It makes sure that the value of xlink:href is not valid as a relative path from the current working directory.

- cd workdir
- inkscape ../datadir/test.svg
- File > Save a Copy... > OpenDocument drawing (*.odg)

As far as I can tell, it was already broken before your changes. I think it used "Inkscape::URI::getFullPath" wrong. I've looked at the Inkscape::URI API but couldn't find appropriate functions yet for this use case.

Revision history for this message
Thomas Holder (speleo3) wrote :
Revision history for this message
Thomas Holder (speleo3) wrote :

Patch:
https://gitlab.com/inkscape/inkscape/merge_requests/333

Attaching a more sophisticated test case which picks up a wrong image (workdir/subdir/triangle.png) without the patch. Also contains an absolute path (file:///tmp/bug-1793940-testcase/datadir/subdir/absolute.png), adjust that before testing.

Changed in inkscape:
assignee: nobody → Thomas Holder (speleo3)
Thomas Holder (speleo3)
Changed in inkscape:
assignee: Thomas Holder (speleo3) → nobody
status: New → Confirmed
Thomas Holder (speleo3)
Changed in inkscape:
assignee: nobody → Thomas Holder (speleo3)
Thomas Holder (speleo3)
Changed in inkscape:
status: Confirmed → Fix Committed
Patrick Storz (ede123)
Changed in inkscape:
milestone: none → 1.0
Max Gaukler (mgmax)
Changed in inkscape:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.