koajs / static-cache

[MAINTAINERS WANTED] Static cache for koa
293 stars 47 forks source link

length #86

Closed jiazhonglin closed 4 years ago

jiazhonglin commented 4 years ago

HI, I'm using koa-static-cache in my app. my app deploy in the server. when I rollback my app to an old version,my broswer page is broken. I serarch the reason. then I find that when I rollback my app the mtime is ealier than latest one,it cause ctx.length not refresh.
Should file.length refresh whether the mtime old or new?
image

jiazhonglin commented 4 years ago

this line ,should modify as ' if (stats.mtime != file.mtime)' ?

dead-horse commented 4 years ago

looks good to me, can you create a PR to fix this?

jiazhonglin commented 4 years ago

looks good to me, can you create a PR to fix this?

https://github.com/koajs/static-cache/pull/93

I commit a new PR, but test can't be passed , because the test didn't consider the case that " file rollback ", in the test file ,file's mtime set a later time , the case "file rollback", should be cover. in consideration of modify the test file ,may confilect to maintainer's mind, so I didn't modify it. can you cover this case in the test file ?

3imed-jaberi commented 4 years ago

@dead-horse, @jonathanong, @niftylettuce plz close this issue.