mirror of
https://github.com/arduino/Arduino.git
synced 2025-01-31 20:52:13 +01:00
Complete disable cache if the file is not a *_indexes
This commit is contained in:
parent
85e91ef079
commit
4da41f7fa5
@ -164,7 +164,7 @@ public class FileDownloader extends Observable {
|
||||
try {
|
||||
setStatus(Status.CONNECTING);
|
||||
|
||||
final Optional<FileDownloaderCache.FileCached> fileCachedOpt = FileDownloaderCache.getFileCached(downloadUrl);
|
||||
final Optional<FileDownloaderCache.FileCached> fileCachedOpt = FileDownloaderCache.getFileCached(downloadUrl, allowCache);
|
||||
if (fileCachedOpt.isPresent()) {
|
||||
final FileDownloaderCache.FileCached fileCached = fileCachedOpt.get();
|
||||
|
||||
@ -175,11 +175,7 @@ public class FileDownloader extends Observable {
|
||||
} else {
|
||||
openConnectionAndFillTheFile(noResume);
|
||||
|
||||
if (allowCache) {
|
||||
fileCached.updateCacheFile(outputFile);
|
||||
} else {
|
||||
log.info("The file {} was not cached because allow cache is false", downloadUrl);
|
||||
}
|
||||
fileCached.updateCacheFile(outputFile);
|
||||
}
|
||||
} else {
|
||||
openConnectionAndFillTheFile(noResume);
|
||||
|
@ -118,10 +118,16 @@ public class FileDownloaderCache {
|
||||
}
|
||||
|
||||
static Optional<FileCached> getFileCached(final URL remoteURL)
|
||||
throws URISyntaxException, NoSuchMethodException, ScriptException,
|
||||
IOException {
|
||||
return getFileCached(remoteURL, true);
|
||||
}
|
||||
|
||||
static Optional<FileCached> getFileCached(final URL remoteURL, boolean enableCache)
|
||||
throws URISyntaxException, NoSuchMethodException, ScriptException,
|
||||
IOException {
|
||||
// Return always and empty file if the cache is not enable
|
||||
if (!enableCache) {
|
||||
if (!(enableCache && FileDownloaderCache.enableCache)) {
|
||||
log.info("The cache is not enable.");
|
||||
return Optional.empty();
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user