Bug Hunting Session
Bug 76281 - DOCX: FILESAVE: Wrong square brackets in exported citations
Summary: DOCX: FILESAVE: Wrong square brackets in exported citations
Status: RESOLVED FIXED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: filters and storage (show other bugs)
Version:
(earliest affected)
4.3.0.0.alpha0+ Master
Hardware: Other All
: medium normal
Assignee: Jacobo Aragunde Pérez
URL:
Whiteboard: target:4.4.0 target:4.3.0.1
Keywords:
Depends on:
Blocks:
 
Reported: 2014-03-17 17:16 UTC by Jacobo Aragunde Pérez
Modified: 2014-06-07 16:38 UTC (History)
1 user (show)

See Also:
Crash report or crash signature:


Attachments
Test case (8.71 KB, application/vnd.oasis.opendocument.text)
2014-03-17 17:16 UTC, Jacobo Aragunde Pérez
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Jacobo Aragunde Pérez 2014-03-17 17:16:33 UTC
Created attachment 95957 [details]
Test case

Steps to reproduce:

1. Open the attached file.
2. Save as a docx.
3. Reload it (File -> Reload).
4. The citation [ARJ00] becomes [[ARJ00]].
5. If you open with Word, the citation becomes "ARJ00]".

Cause:

In the saved document the citation looks like this:
  <w:t>ARJ00]</w:t>

Probably the additional brackets in step 5 are added by the importer, in any case there is an error in the exporter.
Comment 1 Jorendc 2014-03-18 17:14:13 UTC
Reproducible, tested using Windows 8.1 with LibreOffice Version: 4.3.0.0.alpha0+
Build ID: 87efec9cc27b18aa09e50c289b503ba1127eb0b8
TinderBox: Win-x86@39, Branch:master, Time: 2014-03-18_02:50:50

Kind regards,
Joren
Comment 2 Jacobo Aragunde Pérez 2014-06-06 18:13:20 UTC
There are some unbalanced ifs in the code of SwAuthorityField::ConditionalExpand:

    if(pAuthType->GetPrefix() && eField != AUTH_FIELD_TITLE)
        sRet = OUString(pAuthType->GetPrefix()); // adds [
    ...
            sRet += pEntry->GetAuthorField(AUTH_FIELD_IDENTIFIER);
    ...
    if(pAuthType->GetSuffix())
        sRet += OUString(pAuthType->GetSuffix()); // adds ]

Obviously, they should have the same condition.

The change as introduced in commit 06f7d1a96eef5aa69d4872ff6d96eb5085296d09, I'm not sure why we should remove the brackets when exporting to .docx, but I will at least rebalance the ifs.
Comment 3 Commit Notification 2014-06-06 18:21:25 UTC
Jacobo Aragunde Perez committed a patch related to this issue.
It has been pushed to "master":

http://cgit.freedesktop.org/libreoffice/core/commit/?id=0ed60a973753d143158c5b17c781bac07bfc3827

fdo#76281: Fix wrong square brackets in exported citations



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 4 Commit Notification 2014-06-07 16:37:10 UTC
Jacobo Aragunde Perez committed a patch related to this issue.
It has been pushed to "libreoffice-4-3":

http://cgit.freedesktop.org/libreoffice/core/commit/?id=729ad1210c6c55eece7550e43437b9cb2c8fded3&h=libreoffice-4-3

fdo#76281: Fix wrong square brackets in exported citations


It will be available in LibreOffice 4.3.

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.