Merge branch '2.1.x'

Closes gh-17122
pull/17022/head
Andy Wilkinson 6 years ago
commit 5e3c86ab8d

@ -26,6 +26,8 @@ import io.undertow.server.handlers.resource.ResourceChangeListener;
import io.undertow.server.handlers.resource.ResourceManager; import io.undertow.server.handlers.resource.ResourceManager;
import io.undertow.server.handlers.resource.URLResource; import io.undertow.server.handlers.resource.URLResource;
import org.springframework.util.StringUtils;
/** /**
* {@link ResourceManager} for JAR resources. * {@link ResourceManager} for JAR resources.
* *
@ -48,7 +50,7 @@ class JarResourceManager implements ResourceManager {
public Resource getResource(String path) throws IOException { public Resource getResource(String path) throws IOException {
URL url = new URL("jar:file:" + this.jarPath + "!" + (path.startsWith("/") ? path : "/" + path)); URL url = new URL("jar:file:" + this.jarPath + "!" + (path.startsWith("/") ? path : "/" + path));
URLResource resource = new URLResource(url, path); URLResource resource = new URLResource(url, path);
if (resource.getContentLength() < 0) { if (StringUtils.hasText(path) && !"/".equals(path) && resource.getContentLength() < 0) {
return null; return null;
} }
return resource; return resource;

Loading…
Cancel
Save