Issue 118728 - linked svg graphic looses link
Summary: linked svg graphic looses link
Alias: None
Product: Writer
Classification: Application
Component: open-import (show other issues)
Version: 3.4.0 Beta (OOo)
Hardware: PC Windows XP
: P5 (lowest) Normal (vote)
Target Milestone: ---
Assignee: Armin Le Grand
QA Contact:
Depends on:
Reported: 2012-01-05 16:18 UTC by Regina Henschel
Modified: 2012-09-21 03:19 UTC (History)
3 users (show)

See Also:
Issue Type: DEFECT
Latest Confirmation in: ---
Developer Difficulty: ---

svg graphic for testing (29.83 KB, image/svg+xml)
2012-01-05 16:18 UTC, Regina Henschel
no flags Details

Note You need to log in before you can comment on or make changes to this issue.
Description Regina Henschel 2012-01-05 16:18:34 UTC
Created attachment 77102 [details]
svg graphic for testing

Save the attached svg-graphic to your PC.
Open a new Writer document.
Insert the svg-graphic as linked graphic.
Save the document and close it.
Reopen the document.

Notice the read error. The link is still listed in Edit > Links..., but the graphic is not loaded.
Comment 1 Raphael Bircher 2012-01-07 08:46:07 UTC
Please put confirmed issues directly to NEW

Changed Status: NEW
Comment 2 Armin Le Grand 2012-01-10 15:36:01 UTC
ALG: Happens as desrcibed. The 'Read error' also comes up initially with e.g. a gif, but Writer will then load and show it. Checking where the difference is between a gif Writer graphic object and a Svg one...
Comment 3 Armin Le Grand 2012-01-10 16:17:04 UTC
ALG: Seems as if the Svg provided does not have a DOCTYPE identifier which I used for Svg identification in ImpPeekGraphicFormat (svtools). Checking Svg spec if this is allowed to not have it...
Comment 4 Regina Henschel 2012-01-10 16:33:30 UTC
Hi Armin, it is recommended not to have it, see, last sentence.
Comment 5 Regina Henschel 2012-01-10 17:40:29 UTC
now the correct one
Comment 6 Armin Le Grand 2012-01-11 09:36:31 UTC
ALG->Regina: Thanks for the hint, very useful. I already looked at that definitions. I formally used the following checks (for the first 256 bytes):

- 'DOCTYPE' is part of it
- 'svg' is part of it

I now modified to use:

- '<?xml' -> identify as Xml at all
- 'version' -> also Xml, but also Svg
- '' -> has to do with w3, part of Svg namespace definition
- '<svg' -> contains (at least) one Svg node

Comment 7 Armin Le Grand 2012-01-11 11:44:34 UTC
ALG: Comitted, waiting for comments, but done so far.
Comment 8 Regina Henschel 2012-01-11 20:39:17 UTC
If the document has a Doctype declaration, it is possible, that '<svg' is not inside the first 256 bytes. This happens, because it is allowed that a Doctype contains an internal DTD subset. Such an example is given in chapter "3.2.  SVG as the Host Language" in

Therefore the simple test '<svg' might fail.
Perhaps a combining test with '<svg' || ('DOCTYPE' && 'svg') is safer.
Comment 9 Armin Le Grand 2012-01-12 13:08:30 UTC
ALG: You are correct, I stubled already over files with lot of comment text where '<svg' was outside the 1st 256 bytes. I have now changed to do the following:

(1) if(check('<?xml', 256) && check('version', 256)))
(2)   if(check('DOCTYPE', 256) && check('svg', 256))
(3)   else if(check('<svg', 256))
(4)   else if(check('<svg', fullsize))
(5)     is_svg;

Seems okay and handles all cases I stumbled upon. If 1-3 fails, evtl. the full file is checked, but should happen very rarely.
Comment 10 Armin Le Grand 2012-01-16 14:40:04 UTC
ALG: Woks as expected, checked in, done.
Comment 11 Du Jing 2012-09-21 03:19:21 UTC
verified on the build AOO3.5_r1387482