[JENKINS-61121] Fix too many open files with resource domain

This commit is contained in:
Daniel Beck committed 2020-02-18 14:38:48 +01:00
1 parent b39ff9938a
commit 548d9969cc
1 file changed
+2 -3
@@ -346,13 +346,12 @@ public final class DirectoryBrowserSupport implements HttpResponse {
if(LOGGER.isLoggable(Level.FINE))
LOGGER.fine("Serving "+baseFile+" with lastModified=" + lastModified + ", length=" + length);
InputStream in = baseFile.open();
if (view) {
// for binary files, provide the file name for download
rsp.setHeader("Content-Disposition", "inline; filename=" + baseFile.getName());
// pseudo file name to let the Stapler set text/plain
rsp.serveFile(req, in, lastModified, -1, length, "plain.txt");
rsp.serveFile(req, baseFile.open(), lastModified, -1, length, "plain.txt");
} else {
if (resourceToken != null) {
// redirect to second domain
@@ -368,7 +367,7 @@ public final class DirectoryBrowserSupport implements HttpResponse {
}
}
}
rsp.serveFile(req, in, lastModified, -1, length, baseFile.getName());
rsp.serveFile(req, baseFile.open(), lastModified, -1, length, baseFile.getName());
}
}
}