[Mono-bugs] [Bug 557797] New: System.IO.Packaging.PackagePart with an URI containing spaces cannot be read

bugzilla_noreply at novell.com bugzilla_noreply at novell.com
Mon Nov 23 12:09:39 EST 2009


http://bugzilla.novell.com/show_bug.cgi?id=557797

http://bugzilla.novell.com/show_bug.cgi?id=557797#c0


           Summary: System.IO.Packaging.PackagePart with an URI containing
                    spaces cannot be read
    Classification: Mono
           Product: Mono: Class Libraries
           Version: 2.4.x
          Platform: x86
        OS/Version: openSUSE 11.0
            Status: NEW
          Severity: Normal
          Priority: P5 - None
         Component: System
        AssignedTo: mono-bugs at lists.ximian.com
        ReportedBy: mhartmann at vr-web.de
         QAContact: mono-bugs at lists.ximian.com
          Found By: ---
           Blocker: ---


User-Agent:       Mozilla/5.0 (X11; U; Linux i686; de; rv:1.9.1.5)
Gecko/20091109 Ubuntu/9.10 (karmic) Firefox/3.5.5

I'm trying to read packages that were created with System.IO.Packaging on a
Windows machine using .NET.

If the PackagePart URI contains spaces the result of Package.GetPart() is null.



Reproducible: Always

Steps to Reproduce:
1. Use the following code to generate a package with a part containing a space
in the URI

string fileName = "Test.zip";
Uri uri = PackUriHelper.CreatePartUri(new Uri("/My Folder/Test.txt",
UriKind.Relative));

using (Package package = Package.Open(fileName, FileMode.Create))
{
    PackagePart part = package.CreatePart(uri,
System.Net.Mime.MediaTypeNames.Text.Plain);
    using (StreamWriter sw = new StreamWriter(part.GetStream()))
    {
        sw.WriteLine("Hello World");
    }
} 

2. This code re-opens the package and reads the package part

using (Package package = Package.Open(fileName, FileMode.Open))
{
    PackagePart part = package.GetPart(uri);
    using (StreamReader sr = new StreamReader(part.GetStream()))
    {
        Console.WriteLine(sr.ReadLine("Hello World"));
    }
} 
Actual Results:  
When using the 1st step to generate a package the results on Windows/.NET and
Linux/Mono respectively are different.

On Windows/.NET the package contains a folder with the name "My%20Folder". With
Linux/Mono the name of the folder is "My Folder".

Expected Results:  
It seems that URI of the package has to be escaped so that name of the folder
in the package is "My%20Folder".

-- 
Configure bugmail: http://bugzilla.novell.com/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the QA contact for the bug.
You are the assignee for the bug.


More information about the mono-bugs mailing list