Bug 97379 - Can not open .docx generated by BDoc
Summary: Can not open .docx generated by BDoc
Status: RESOLVED DUPLICATE of bug 96401
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: filters and storage (show other bugs)
(earliest affected) release
Hardware: All All
: medium normal
Assignee: Not Assigned
Keywords: filter:docx
Depends on:
Blocks: DOCX-Opening
  Show dependency treegraph
Reported: 2016-01-26 13:21 UTC by David KELLER
Modified: 2021-11-04 09:06 UTC (History)
7 users (show)

See Also:
Crash report or crash signature:
Regression By:

updated by word - using bdoc generator (15.45 KB, application/vnd.openxmlformats-officedocument.wordprocessingml.document)
2016-01-26 13:37 UTC, David KELLER
using bdoc generator.docx (14.37 KB, application/vnd.openxmlformats-officedocument.wordprocessingml.document)
2016-01-26 13:37 UTC, David KELLER

Note You need to log in before you can comment on or make changes to this bug.
Description David KELLER 2016-01-26 13:21:59 UTC Comment hidden (obsolete)
Comment 1 David KELLER 2016-01-26 13:37:04 UTC
Created attachment 122218 [details]
updated by word - using bdoc generator
Comment 2 David KELLER 2016-01-26 13:37:25 UTC
Created attachment 122219 [details]
using bdoc generator.docx
Comment 3 David KELLER 2016-01-26 13:40:56 UTC
The generated document using Business Docucment API can not be opened by LibreOffice.
=> impossible to repair
=> general exception occurs

Then I open this document using WOrd 2013, and make few changes and save it.

Then LibreOffice can open the document.

What is wrong ? http://www.bdoc.com/ or libreboffice ?

kind regards,
Comment 4 Urmas 2016-01-27 19:16:51 UTC
There are some errors in the ZIP archive structure, it seems.
Comment 5 Joel Madero 2016-01-27 19:25:10 UTC
Why is this new given that there are problems with the zip file structure? Seems like NOTOURBUG without more information indicating that it's ours.
Comment 6 Urmas 2016-01-28 00:32:01 UTC
Because validating archive correctness is beyond the scope of LO. As long as there is no physical corruption, document should be opened.
Comment 7 QA Administrators 2017-12-10 16:42:44 UTC Comment hidden (obsolete)
Comment 8 Roman Kuznetsov 2018-10-24 10:12:20 UTC
still repro in

Build ID: cec31fdedd7c94f4ebf903a66456a75867db22b0
CPU threads: 4; OS: Windows 6.1; UI render: default; VCL: win; 
TinderBox: Win-x86@42, Branch:master, Time: 2018-10-21_22:54:44
Locale: ru-RU (ru_RU); Calc: threaded

but my opinion -> NOTOURBUG, because answer on this question:

>What is wrong ? http://www.bdoc.com/ or libreboffice ?

is http://www.bdoc.com/

Xisco, what do you think?
Comment 9 Julien Nabet 2019-08-15 10:38:30 UTC
With this patch, I could open the file:
diff --git a/comphelper/source/misc/storagehelper.cxx b/comphelper/source/misc/storagehelper.cxx
index f7180bdd230a..392d3963d5a9 100644
--- a/comphelper/source/misc/storagehelper.cxx
+++ b/comphelper/source/misc/storagehelper.cxx
@@ -572,7 +572,7 @@ bool OStorageHelper::IsValidZipEntryFileName(
         switch ( pChar[i] )
-            case '\\':
+//            case '\\':
             case '?':
             case '<':
             case '>':

The pb is bdoc generator created a zip file with '/', here is the output of unzip:
   creating: docProps/
  inflating: docProps/app.xml        
  inflating: docProps/core.xml       
   creating: word/
  inflating: word/fontTable.xml      
   creating: word\media/
  inflating: word/numbering.xml      
  inflating: word/settings.xml       
   creating: word\theme/
  inflating: word/theme/theme1.xml   
  inflating: word/webSettings.xml    
   creating: word\_rels/
   creating: _rels/
  inflating: word/footnotes.xml      
  inflating: word/endnotes.xml       
  inflating: word/document.xml       
  inflating: word/_rels/document.xml.rels  
  inflating: [Content_Types].xml     
  inflating: _rels/.rels             
  inflating: word/styles.xml         

Quotation from zip spec https://pkware.cachefly.net/webdocs/casestudies/APPNOTE.TXT:
   4.4.17 file name: (Variable) The name of the file, with optional relative path.
       The path stored MUST NOT contain a drive or
       device letter, or a leading slash.  All slashes
       MUST be forward slashes '/' as opposed to
       backwards slashes '\' for compatibility with Amiga
       and UNIX file systems etc.  If input came from standard
       input, there is no file name field.

Perhaps we could be strict when writing a zip file and less strict when reading one?
Comment 10 Julien Nabet 2020-02-28 09:54:53 UTC
On Win10 with master sources updated today, it still fails for the same reason.
The same patch from https://bugs.documentfoundation.org/show_bug.cgi?id=97379#c9 (except line number which changed) makes it work.

But should we consider this as NOTOURBUG or should we try to fix this for reading part (hoping that IsValidZipEntryFileName is just used for read part).

Xisco: any thoughts here?
Comment 11 Timur 2020-09-16 10:19:23 UTC
Xisco, please take this and CC bug to ESC for a decision.
Comment 12 Kevin Suo 2021-11-04 09:06:00 UTC
$ zipinfo "/home/suokunlong/下载/tmp/using bdoc generator.docx"
Archive:  /home/suokunlong/下载/tmp/using bdoc generator.docx
Zip file size: 14711 bytes, number of entries: 20
drwx---     0.0 fat        0 b- defN 14-May-23 15:07 docProps/
-rw-a--     0.0 fat      999 b- defN 14-May-23 13:07 docProps/app.xml
-rw-a--     0.0 fat      729 b- defN 14-May-23 13:07 docProps/core.xml
drwx---     0.0 fat        0 b- defN 14-May-23 15:07 word/
-rw-a--     0.0 fat     1561 b- defN 14-May-23 13:07 word/fontTable.xml
drwx---     0.0 fat        0 b- defN 14-May-23 15:07 word\media/
-rw-a--     0.0 fat     6424 b- defN 14-May-23 15:07 word/numbering.xml
-rw-a--     0.0 fat     1980 b- defN 14-May-23 13:07 word/settings.xml
drwx---     0.0 fat        0 b- defN 14-May-23 15:07 word\theme/
-rw-a--     0.0 fat     6992 b- defN 14-May-23 13:07 word/theme/theme1.xml
-rw-a--     0.0 fat      260 b- defN 14-May-23 13:07 word/webSettings.xml
drwx---     0.0 fat        0 b- defN 14-May-23 15:07 word\_rels/
drwx---     0.0 fat        0 b- defN 14-May-23 15:07 _rels/
-rw-a--     0.0 fat     1556 b- defN 16-Jan-26 11:13 word/footnotes.xml
-rw-a--     0.0 fat     1554 b- defN 16-Jan-26 11:13 word/endnotes.xml
-rw-a--     0.0 fat    53721 t- defN 16-Jan-26 10:13 word/document.xml
-rw-a--     0.0 fat     1186 t- defN 16-Jan-26 10:13 word/_rels/document.xml.rels
-rw-a--     0.0 fat     2186 t- defN 16-Jan-26 10:13 [Content_Types].xml
-rw-a--     0.0 fat      605 t- defN 16-Jan-26 10:13 _rels/.rels
-rw----     0.0 fat    35900 t- defN 14-May-23 14:07 word/styles.xml
20 files, 115653 bytes uncompressed, 12559 bytes compressed:  89.1%

See https://bugs.documentfoundation.org/show_bug.cgi?id=96401#c17

*** This bug has been marked as a duplicate of bug 96401 ***