]> git.lyx.org Git - features.git/commitdiff
backport fix for bug #7973
authorGeorg Baum <georg.baum@post.rwth-aachen.de>
Thu, 19 Jan 2012 20:21:53 +0000 (20:21 +0000)
committerGeorg Baum <georg.baum@post.rwth-aachen.de>
Thu, 19 Jan 2012 20:21:53 +0000 (20:21 +0000)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/branches/BRANCH_2_0_X@40631 a592a061-630c-0410-9148-cb99ea01b6c8

src/support/FileName.cpp
status.20x

index a16278fce4d21f720be487e6dad7913b728cb146..f88e1eb13d67ecbeb645a1c1cb9700cae3909ccc 100644 (file)
@@ -813,6 +813,9 @@ string FileName::guessFormatFromContents() const
        // PKZIP
        static string const zipStamp = "PK";
 
+       // ZIP containers (koffice, openoffice.org etc).
+       static string const nonzipStamp = "\008\0\0\0mimetypeapplication/";
+
        // compress
        static string const compressStamp = "\037\235";
 
@@ -840,7 +843,8 @@ string FileName::guessFormatFromContents() const
                        if (prefixIs(str, gzipStamp)) {
                                format =  "gzip";
 
-                       } else if (stamp == zipStamp) {
+                       } else if (stamp == zipStamp &&
+                                  !contains(str, nonzipStamp)) {
                                format =  "zip";
 
                        } else if (stamp == compressStamp) {
index 7d10fcd92a2f96ada84f9058bf8597fb792e4b52..f3f7afc6ced661d3b8f14765ac37fef176a7ef4d 100644 (file)
@@ -137,6 +137,8 @@ What's new
 - Do not use \inputencoding for translated names of theorem-like environments
   if they can be actually encoded in the chosen document encoding (bug 7800).
 
+- Do mot misdetect office file formats as zip (bug 7973).
+
 
 * TEX2LYX