Fix unnecessary temp path resolution in PackageResolvers (#219)

The only call site already resolved the path against tmpDir.
This commit is contained in:
translatenix
2024-02-20 20:47:28 -08:00
committed by GitHub
parent ffc629f28f
commit 91367ed065

View File

@@ -446,13 +446,12 @@ class PackageResolvers {
return path.substring(lastSep + 1);
}
private byte[] downloadUriToPathAndComputeChecksum(URI downloadUri, Path relativePath)
private byte[] downloadUriToPathAndComputeChecksum(URI downloadUri, Path path)
throws IOException, SecurityManagerException {
var tmpPath = tmpDir.resolve(relativePath);
Files.createDirectories(tmpPath.getParent());
Files.createDirectories(path.getParent());
var inputStream = openExternalUri(downloadUri);
try (var digestInputStream = newDigestInputStream(inputStream)) {
Files.copy(digestInputStream, tmpPath);
Files.copy(digestInputStream, path);
return digestInputStream.getMessageDigest().digest();
}
}