Issue #1539 decode path in jar:file

This commit is contained in:
Greg Wilkins 2017-05-10 14:23:52 +02:00
parent 9f5909b98b
commit 4ab08c0e80
3 changed files with 10 additions and 1 deletions

View File

@ -29,6 +29,7 @@ import java.util.List;
import java.util.jar.JarEntry;
import java.util.jar.JarFile;
import org.eclipse.jetty.util.URIUtil;
import org.eclipse.jetty.util.log.Log;
import org.eclipse.jetty.util.log.Logger;
@ -123,7 +124,7 @@ class JarFileResource extends JarResource
int sep = _urlString.lastIndexOf("!/");
_jarUrl=_urlString.substring(0,sep+2);
_path=_urlString.substring(sep+2);
_path=URIUtil.decodePath(_urlString.substring(sep+2));
if (_path.length()==0)
_path=null;
_jarFile=_jarConnection.getJarFile();

View File

@ -201,5 +201,13 @@ public class JarResourceTest
assertFalse(dest.exists());
}
@Test
public void testEncodedFileName()
throws Exception
{
String s = "jar:"+testResURI+"TestData/test.zip!/file%20name.txt";
Resource r = Resource.newResource(s);
assertTrue(r.exists());
}
}