Bug 63053 - FILESAVE, FILEOPEN: ampersand in document title causes corrupt docx when saving; truncates title when loading
Summary: FILESAVE, FILEOPEN: ampersand in document title causes corrupt docx when savi...
Status: RESOLVED FIXED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Writer (show other bugs)
Version:
(earliest affected)
4.0.1.2 release
Hardware: x86-64 (AMD64) macOS (All)
: low normal
Assignee: Not Assigned
URL:
Whiteboard: target:4.2.0
Keywords:
Depends on:
Blocks:
 
Reported: 2013-04-03 02:57 UTC by PT
Modified: 2013-07-21 10:15 UTC (History)
0 users

See Also:
Crash report or crash signature:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description PT 2013-04-03 02:57:56 UTC
Two related problems with docx files, which both seem to arise from LO putting and expecting raw ampersands, rather than & entities, in the docx file's docProps/core.xml file.


Steps to reproduce the FILESAVE problem:

1. Create new, empty writer document.
2. Set the document title (File->Properties->Description->Title) to a value containing an ampersand, e.g. "Title & more"
3. Save as Microsoft Word 2007/2010 XML (.docx).
4. Attempt to load in Microsoft Word 2010.

Expected result:

Document loads successfully.

Actual result:

"The file ... cannot be opened because there are problems with the contents", and and offer to recover.

Contents of the relevant field in docProps/core.xml:

<dc:title>Title & more</dc:title>


Steps to reproduce the FILELOAD problem:

1. Create a new, empty document in Microsoft Word 2010.
2. Set the document title to a value containing an ampersand.
3. Save in Microsoft Word's native docx format.
4. Load in LO.

Expected result:

Loads with title set correctly.

Actual result:

File loads normally, but the title is truncated, but all of the title up to and including the ampersand is lost -- in the above example, the title would appear as " and more".

Contents of the relevant field in docProps/core.xml:

<dc:title>Title &amp; more</dc:title>


These issues are easily worked around by avoiding using ampersands in document titles. However it is probably worth investigating in case there are some other, more serious situations in which we are generating invalid XML, or failing to parse XML correctly, for the same underlying reason.

I have not yet checked whether the same issue arises with XLSX and PPTX files, or with other metadata fields.
Comment 1 Jorendc 2013-04-08 20:15:16 UTC
Hi,

Thanks for reporting and the clear steps!

I can reproduce this behavior using Mac OSX 10.8.3 with LibreOffice 4.0.2.2 in combination of Word for Mac 2011.
Therefore I mark this as NEW.

Marking this bug as Medium Low
Medium: odd behavior of the title field, can cause some problems when the recovery isn't successful using Word
Low: not used that many, therefore lowering the priority a bit.

Kind regards,
Joren
Comment 2 Commit Notification 2013-06-15 11:01:50 UTC
abdulmajeed ahmed committed a patch related to this issue.
It has been pushed to "master":

http://cgit.freedesktop.org/libreoffice/core/commit/?id=36de708ce421b31beaaddb1048d444de91b2e5e9

fix fdo#63053 ampersand in document title causes corrupt docx



The patch should be included in the daily builds available at
http://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
http://wiki.documentfoundation.org/Testing_Daily_Builds
Affected users are encouraged to test the fix and report feedback.
Comment 3 Lior Kaplan 2013-07-21 10:15:55 UTC
Can we have a sample doc so the fix could be verified ?