Issue 115297 - WW8: Export of relative hyperlinks is in a non-portable format, unusable by MS applications
WW8: Export of relative hyperlinks is in a non-portable format, unusable by M...
 Status: CONFIRMED None Writer Application save-export (show other issues) OOo 3.2.1 Unknown All P3 Trivial (vote) --- AOO issues mailing list

 Reported: 2010-10-28 15:30 UTC by knobo 2013-08-07 14:44 UTC (History) 1 user (show) issues PATCH --- ---

Attachments
fixing relative paths in hyperlinks to be more portable. (1.36 KB, text/plain)
2010-10-28 20:19 UTC, knobo
no flags Details
Added missing parentheses (1.36 KB, text/plain)
2010-10-28 20:37 UTC, knobo
no flags Details

 Note You need to log in before you can comment on or make changes to this issue.
 knobo 2010-10-28 15:30:41 UTC To reproduce (method 1): Create a new "Microsoft Word 97/2000/XP" .doc document writer. Insert a hyperlink to another .doc document. Save. Open the document Microsoft Word Viewer, and the hyperlink does not work. To reproduce (method 2): Open an important .doc file that you've got with one or more hyperlink in OpenOffice.org, save it. Now your document is broken :P knobo 2010-10-28 15:39:13 UTC The problem is that OpenOffice.org uses "/" in the path in stead of "\". As OpenOffice.org is more flexible then MS Word and friends, we should probably export relativ hyperlinks with \ in the path to avoid irritating and locking out 99% of Office-application users. knobo 2010-10-28 15:43:40 UTC I found the following code in wrtw8nds.cxx I guess we should add an extra check for ../ and replace every "/" with "\" // special case for the absolute windows names // (convert '/c:/foo/bar.doc' into 'c:\foo\bar.doc') sal_Unicode aDrive = ( sURL.Len() > 1 )? sURL.GetChar( 1 ): 0; if ( sURL.EqualsAscii( "/", 0, 1 ) && ( ( aDrive >= 'A' && aDrive <= 'Z' ) || ( aDrive >= 'a' && aDrive <= 'z' ) ) && sURL.EqualsAscii( ":", 2, 1 ) ) { sURL.Erase( 0, 1 ); sURL.SearchAndReplaceAll( '/', '\\' ); }  michael.ruess 2010-10-28 17:22:03 UTC MRU->HBRINKM: please have a look whether the proposed patch can help here. Maybe this will also fix issue 31267. knobo 2010-10-28 18:28:03 UTC It did not solve the problem. I have to look in a different place. There where some places the / was converted to \, but not in the right place. I'll try again later tonight. knobo 2010-10-28 20:02:55 UTC in the following function: bool WW8AttributeOutput::AnalyzeURL( const String& rUrl, const String& rTarget, String* pLinkURL, String* pMark ) { I changed if ( sURL.Len() ){ sURL = URIHelper::simpleNormalizedMakeRelative( m_rWW8Export.GetWriter().GetBaseURL(), sURL ); to if ( sURL.Len() ){ sURL = URIHelper::simpleNormalizedMakeRelative( m_rWW8Export.GetWriter().GetBaseURL(), sURL ); sURL.SearchAndReplaceAll( '/', '\\' ); } And my problem was solved.  knobo 2010-10-28 20:19:05 UTC Created attachment 72773 [details] fixing relative paths in hyperlinks to be more portable. knobo 2010-10-28 20:20:51 UTC The patch probably needs a good look-over, as I have no idea of what I have done. It just works for me. knobo 2010-10-28 20:37:26 UTC Created attachment 72775 [details] Added missing parentheses knobo 2010-11-02 16:03:44 UTC I'm not sure how I came to the conclusion that it worked. I have found out that OOo saves all hyperlinks with the "absolute-link" attr set. I unset it now, I have tested it and putting it in production now. I'll let you know how it goes. Martin Hollmichel 2011-03-16 11:44:30 UTC set target 3.x since not relevant for 3.4 release. Pedro Giffuni 2013-01-26 03:37:56 UTC Unfortunately the patches here don't fix the issue. In LibreOffice the issue was fixed by a patch to sw/source/filter/ww8/wrtw8nds.cxx in function WW8AttributeOutput::StartURL by introducing a check in line 942. The log says: Actually check that the output URL is relative or absolute. Non mark-only URLs doesn't necessarily reflect absolute URLs! Rob Weir 2013-03-11 15:00:44 UTC I'm adding this comment to all open issues with Issue Type == PATCH. We have 220 such issues, many of them quite old. I apologize for that. We need your help in prioritizing which patches should be integrated into our next release, Apache OpenOffice 4.0. If you have submitted a patch and think it is applicable for AOO 4.0, please respond with a comment to let us know. On the other hand, if the patch is no longer relevant, please let us know that as well. If you have any general questions or want to discuss this further, please send a note to our dev mailing list: dev@openoffice.apache.org Thanks! -Rob