mirror of
https://github.com/overleaf/overleaf.git
synced 2025-02-03 01:01:42 +00:00
check if files exist before fingerprinting them issue #75 on sharelatex
This commit is contained in:
parent
c237d04456
commit
4864eeba0a
1 changed files with 9 additions and 4 deletions
|
@ -25,10 +25,15 @@ for path in [
|
||||||
"/brand/plans.css"
|
"/brand/plans.css"
|
||||||
]
|
]
|
||||||
filePath = Path.join __dirname, "../../../", "public#{path}"
|
filePath = Path.join __dirname, "../../../", "public#{path}"
|
||||||
|
exists = fs.existsSync filePath
|
||||||
|
if exists
|
||||||
content = fs.readFileSync filePath
|
content = fs.readFileSync filePath
|
||||||
hash = crypto.createHash("md5").update(content).digest("hex")
|
hash = crypto.createHash("md5").update(content).digest("hex")
|
||||||
logger.log "#{filePath}: #{hash}"
|
logger.log "#{filePath}: #{hash}"
|
||||||
fingerprints[path] = hash
|
fingerprints[path] = hash
|
||||||
|
else
|
||||||
|
logger.log filePath:filePath, "file does not exist for fingerprints"
|
||||||
|
|
||||||
|
|
||||||
module.exports = (app)->
|
module.exports = (app)->
|
||||||
app.use (req, res, next)->
|
app.use (req, res, next)->
|
||||||
|
|
Loading…
Reference in a new issue