mirror of
https://github.com/ysoftdevs/DependencyCheck.git
synced 2026-03-20 16:24:11 +01:00
attempting fix for Windows file:/// URI
Former-commit-id: 38a26b41aa2ebed8e043ec4dd5a0096a353b650d
This commit is contained in:
@@ -130,10 +130,19 @@ public final class Downloader {
|
|||||||
public static long getLastModified(URL url) throws DownloadFailedException {
|
public static long getLastModified(URL url) throws DownloadFailedException {
|
||||||
long timestamp = 0;
|
long timestamp = 0;
|
||||||
//TODO add the FPR protocol?
|
//TODO add the FPR protocol?
|
||||||
if ("file:".equalsIgnoreCase(url.getProtocol())) {
|
if ("file".equalsIgnoreCase(url.getProtocol())) {
|
||||||
File f;
|
File f;
|
||||||
try {
|
try {
|
||||||
|
if (System.getProperty("os.name").toLowerCase().startsWith("windows")) {
|
||||||
|
String filePath = url.toString();
|
||||||
|
if (filePath.matches("file://[a-zA-Z]:.*")) {
|
||||||
|
f = new File(filePath.substring(7));
|
||||||
|
} else {
|
||||||
f = new File(url.toURI());
|
f = new File(url.toURI());
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
f = new File(url.toURI());
|
||||||
|
}
|
||||||
} catch (URISyntaxException ex) {
|
} catch (URISyntaxException ex) {
|
||||||
final String msg = String.format("Unable to locate '%s'; is the cve.url-2.0.modified property set correctly?", url.toString());
|
final String msg = String.format("Unable to locate '%s'; is the cve.url-2.0.modified property set correctly?", url.toString());
|
||||||
throw new DownloadFailedException(msg);
|
throw new DownloadFailedException(msg);
|
||||||
|
|||||||
Reference in New Issue
Block a user