[WindowsBase] Don't treat special file [Content-Types].xml as a part, ends up as...
authorJérémie Laval <jeremie.laval@gmail.com>
Tue, 11 Oct 2011 14:13:51 +0000 (16:13 +0200)
committerJérémie Laval <jeremie.laval@gmail.com>
Tue, 11 Oct 2011 14:14:50 +0000 (16:14 +0200)
mcs/class/WindowsBase/System.IO.Packaging/ZipPackage.cs
mcs/class/WindowsBase/Test/System.IO.Packaging/PackagePartTest.cs

index 0a113364c520aeccf46720eca559177b4c1e9b7c..b6ff1ce50cb4e93c2083fdb4b1d4bb899cd9da91 100644 (file)
@@ -157,6 +157,9 @@ namespace System.IO.Packaging {
 
                                        // The file names in the zip archive are not prepended with '/'
                                        foreach (string file in archive.GetFiles ()) {
+                                               if (file.Equals (ContentUri, StringComparison.Ordinal))
+                                                       continue;
+
                                                XmlNode node;
                                                CompressionOption compression = archive.GetCompressionLevel (file);
 
index 97aaa5b400d1b8c7ebdc525d7feec85c9d392529..0abdd2f23a12bf442efd10f0179f9d98b77e6bf3 100644 (file)
@@ -325,11 +325,9 @@ namespace System.IO.Packaging.Tests {
         }\r
 \r
         [Test]\r
-        [ExpectedException (typeof (ArgumentException))]\r
-        [Ignore ("Proper validation of the Uris is not performed")]\r
         public void CheckContentTypes ()\r
         {\r
-            package.PartExists(new Uri ("/[Content_Types].xml", UriKind.Relative));\r
+               Assert.IsFalse (package.PartExists(new Uri ("[Content_Types].xml", UriKind.Relative)));\r
         }\r
     }\r
 }\r