File tree Expand file tree Collapse file tree 1 file changed +15
-1
lines changed
jetty-core/jetty-util/src/main/java/org/eclipse/jetty/util Expand file tree Collapse file tree 1 file changed +15
-1
lines changed Original file line number Diff line number Diff line change @@ -1932,7 +1932,21 @@ public static URI toURI(String reference)
19321932 */
19331933 URI uri = URI .create (reference );
19341934 if (uri .isAbsolute ())
1935- return uri ;
1935+ {
1936+ // At this point we have a string detected as a URI.
1937+ // But that could also include Windows paths like "C:\path\to\foo.jar" or "C:/path/to/foo.jar"
1938+ String scheme = uri .getScheme ();
1939+ if (scheme .length () == 1 && Character .isLetter (scheme .charAt (0 )))
1940+ {
1941+ // Single character schemes are assumed to be windows.
1942+ // Make it a file: URI and process it separately.
1943+ return toURI ("file:///" + uri .toASCIIString ());
1944+ }
1945+ {
1946+ // Anything else, scheme wise, is acceptable.
1947+ return uri ;
1948+ }
1949+ }
19361950 if (LOG .isDebugEnabled ())
19371951 LOG .debug ("Input string is detected as a non-absolute URI \" {}\" " , reference );
19381952 throw new IllegalArgumentException ("Non-absolute URI reference strings not supported" );
You can’t perform that action at this time.
0 commit comments