Skip to content

Commit

Permalink
Lower maximum Expires value to 4h
Browse files Browse the repository at this point in the history
  • Loading branch information
gorhill committed Nov 7, 2023
1 parent 8ed1ad9 commit 2360bc0
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/js/assets.js
Expand Up @@ -55,7 +55,7 @@ const parseExpires = s => {
if ( matches === null ) { return 0; }
let updateAfter = parseInt(matches[1], 10);
if ( matches[2] === 'h' ) {
updateAfter = Math.ceil(updateAfter / 6) / 4;
updateAfter = Math.max(updateAfter, 4) / 24;
}
return updateAfter;
};
Expand All @@ -81,10 +81,10 @@ const extractMetadataFromList = (content, fields) => {
out.lastModified = (new Date(out.lastModified)).getTime() || 0;
}
if ( out.expires ) {
out.expires = Math.max(parseExpires(out.expires), 0.5);
out.expires = parseExpires(out.expires);
}
if ( out.diffExpires ) {
out.diffExpires = Math.max(parseExpires(out.diffExpires), 0.25);
out.diffExpires = parseExpires(out.diffExpires);
}
return out;
};
Expand Down

1 comment on commit 2360bc0

@gorhill
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Commit message is wrong, should be "Lower minimum Expires value to 4h".

Please sign in to comment.