Bug 998 - [PATCH] mono's XmlUrlResolver.ResolveUri handles custom schemes differently to .net
Summary: [PATCH] mono's XmlUrlResolver.ResolveUri handles custom schemes differently t...
Status: RESOLVED FIXED
Alias: None
Product: Class Libraries
Classification: Mono
Component: System.XML ()
Version: master
Hardware: PC Windows
: --- minor
Target Milestone: Untriaged
Assignee: Bugzilla
URL:
Depends on:
Blocks:
 
Reported: 2011-09-22 12:25 UTC by Tom Hindle
Modified: 2012-01-19 06:54 UTC (History)
2 users (show)

Tags:
Is this bug a regression?: ---
Last known good build:


Attachments
bug fix for review. (820 bytes, patch)
2011-09-23 08:44 UTC, Tom Hindle
Details


Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and Mono organizations on GitHub to continue tracking issues. Bugzilla will remain available for reference in read-only mode. We will continue to work on open Bugzilla bugs, copy them to the new locations as needed for follow-up, and add the new items under Related Links.

Our sincere thanks to everyone who has contributed on this bug tracker over the years. Thanks also for your understanding as we make these adjustments and improvements for the future.


Please create a new report on GitHub or Developer Community with your current version information, steps to reproduce, and relevant error messages or log files if you are hitting an issue that looks similar to this resolved bug and you do not yet see a matching new report.

Related Links:
Status:
RESOLVED FIXED

Description Tom Hindle 2011-09-22 12:25:39 UTC
Given following code:

XmlResolver res = new XmlUrlResolver();
var uri = res.ResolveUri(null, "view:Standard.xslt");
Console.WriteLine(uri.Scheme);
Console.WriteLine(uri.AbsolutePath);
Console.WriteLine(uri.AbsoluteUri);

// .NET outputs:
view
Standard.xslt
view:Standard.xslt

// Mono on Linux outputs: 
file
/home/hindlet/Projects/xslCompiledTransformTest/xslCompiledTransformTest/bin/Debug/view:Standard.xslt
file:///home/hindlet/Projects/xslCompiledTransformTest/xslCompiledTransformTest/bin/Debug/view:Standard.xslt

// Mono on Windows outputs:
file
C:/Users/hindlet/Documents/Visual%20Studio%202008/Projects/ConsoleApplication1/ConsoleApplication1/bin/Debug/view:Standard.xslt
file:///C:/Users/hindlet/Documents/Visual%20Studio%202008/Projects/ConsoleApplication1/ConsoleApplication1/bin/Debug/view:Standard.xslt
Comment 1 Tom Hindle 2011-09-23 08:44:41 UTC
Created attachment 478 [details]
bug fix for review.

Rather than just checking http, https, ftp, file allow any specified scheme.
Comment 2 Atsushi Eno 2012-01-19 06:54:35 UTC
Thanks for the report. I made a fix in git master 82f61e9 (in somewhat different approach).

It's a bit difficult decision, as the "relative URI" could be any path string that contain colons as a *valid* path (especially on *nix land).
We historically did allow such relative URI strings that contain "http:" etc. as to be treated as absolute (which historically worked long time).
But this test case uncovered possible other cases.
Hopefully this does not bring issues that is pretty much anticipated. Such issues could also happen in older code anyways (when the relative file path began with "http:foobar" etc.)