Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit dd1d713

Browse files
Mattia Bertorellocmaglie
Mattia Bertorello
authored andcommitted
Fix condition when the file is not expire but the lastETag is changed
1 parent b2235c3 commit dd1d713

File tree

2 files changed

+9
-6
lines changed

2 files changed

+9
-6
lines changed

‎arduino-core/src/cc/arduino/utils/network/FileDownloader.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -171,6 +171,7 @@ private void downloadFile(boolean noResume) throws InterruptedException {
171171
final Optional<File> fileFromCache = getFileCached(fileCached);
172172
if (fileCached.isNotChange() && fileFromCache.isPresent()) {
173173
// Copy the cached file in the destination file
174+
log.info("The file will be taken from the cache {}", fileFromCache);
174175
FileUtils.copyFile(fileFromCache.get(), outputFile);
175176
} else {
176177
openConnectionAndFillTheFile(noResume);

‎arduino-core/src/cc/arduino/utils/network/FileDownloaderCache.java

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -286,17 +286,19 @@ public boolean isNotChange() {
286286
@JsonIgnore
287287
public boolean isChange() {
288288
// Check if the file is expire
289-
if (!isExpire()) {
290-
log.debug("The file \"{}\" is no expire, the eTag will not be checked. Expire time: {}", localPath,
289+
boolean isChange = false;
290+
if (isExpire()) {
291+
log.debug("The file \"{}\" is expire. Expire time: {}", localPath,
291292
this.getExpiresTime().format(DateTimeFormatter.ISO_DATE_TIME));
292-
returnfalse;
293+
isChange = true;
293294
}
294295

295-
if (lastETag != null) {
296+
if (lastETag != null && !lastETag.equals(eTag)) {
296297
// If are different means that the file is change
297-
return !lastETag.equals(eTag);
298+
log.debug("The file \"{}\" is changed last ETag != now Etag ({}!={})", localPath, lastETag, eTag);
299+
isChange = true;
298300
}
299-
return true;
301+
return isChange;
300302
}
301303

302304
@JsonIgnore

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /