mirror of
https://github.com/jetty/jetty.project.git
synced 2025-03-03 20:39:18 +00:00
Merge branch 'fvanderveen-jetty-9.3.x' into jetty-9.3.x
This commit is contained in:
commit
d1c946d192
@ -73,7 +73,17 @@ public class PathResource extends Resource
|
|||||||
|
|
||||||
if(!URIUtil.equalsIgnoreEncodings(uri,path.toUri()))
|
if(!URIUtil.equalsIgnoreEncodings(uri,path.toUri()))
|
||||||
{
|
{
|
||||||
return new File(uri).toPath().toAbsolutePath();
|
try
|
||||||
|
{
|
||||||
|
return Paths.get(uri).toRealPath(FOLLOW_LINKS);
|
||||||
|
}
|
||||||
|
catch (IOException ignored)
|
||||||
|
{
|
||||||
|
// If the toRealPath() call fails, then let
|
||||||
|
// the alias checking routines continue on
|
||||||
|
// to other techniques.
|
||||||
|
LOG.ignore(ignored);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!abs.isAbsolute())
|
if (!abs.isAbsolute())
|
||||||
@ -568,4 +578,4 @@ public class PathResource extends Resource
|
|||||||
{
|
{
|
||||||
return this.uri.toASCIIString();
|
return this.uri.toASCIIString();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -29,6 +29,7 @@ import static org.junit.Assert.assertThat;
|
|||||||
import static org.junit.Assume.assumeFalse;
|
import static org.junit.Assume.assumeFalse;
|
||||||
import static org.junit.Assume.assumeNoException;
|
import static org.junit.Assume.assumeNoException;
|
||||||
import static org.junit.Assume.assumeThat;
|
import static org.junit.Assume.assumeThat;
|
||||||
|
import static org.junit.Assume.assumeTrue;
|
||||||
|
|
||||||
import java.io.BufferedWriter;
|
import java.io.BufferedWriter;
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
@ -1397,5 +1398,19 @@ public class FileSystemResourceTest
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testUncPath() throws Exception
|
||||||
|
{
|
||||||
|
assumeTrue("Only windows supports UNC paths", OS.IS_WINDOWS);
|
||||||
|
assumeFalse("FileResource does not support this test", _class.equals(FileResource.class));
|
||||||
|
|
||||||
|
try (Resource base = newResource(URI.create("file://127.0.0.1/path")))
|
||||||
|
{
|
||||||
|
Resource resource = base.addPath("WEB-INF/");
|
||||||
|
assertThat("getURI()", resource.getURI().toASCIIString(), containsString("path/WEB-INF/"));
|
||||||
|
assertThat("isAlias()", resource.isAlias(), is(true));
|
||||||
|
assertThat("getAlias()", resource.getAlias(), notNullValue());
|
||||||
|
assertThat("getAlias()", resource.getAlias().toASCIIString(), containsString("path/WEB-INF"));
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user