Skip to content

Commit

Permalink
Fix dumb invalid time value issue
Browse files Browse the repository at this point in the history
  • Loading branch information
NotGeri committed Dec 14, 2022
1 parent 8f7fcb0 commit b1e8d17
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 2 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,4 @@ npm-debug.log*
.nyc_*/
.dir-locals.el
.DS_Store
.idea/
9 changes: 8 additions & 1 deletion lib/core/etag.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,14 @@
'use strict';

module.exports = (stat, weakEtag) => {
let etag = `"${[stat.ino, stat.size, stat.mtime.toISOString()].join('-')}"`;
let time;
try {
time = stat.mtime.toISOString();
} catch (e) {
time = new Date().toISOString();
}

let etag = `"${[stat.ino, stat.size, time].join('-')}"`;
if (weakEtag) {
etag = `W/${etag}`;
}
Expand Down
2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit b1e8d17

Please sign in to comment.