소스 검색

invalidate cache when skin file is gone

jomo 10 년 전
부모
커밋
c8dad9dfbb
1개의 변경된 파일7개의 추가작업 그리고 0개의 파일을 삭제
  1. 7 0
      lib/routes/skins.js

+ 7 - 0
lib/routes/skins.js

@@ -53,6 +53,13 @@ module.exports = function(req, callback) {
 
 
   try {
   try {
     helpers.get_skin(rid, userId, function(err, hash, status, image) {
     helpers.get_skin(rid, userId, function(err, hash, status, image) {
+      if (err) {
+        logging.error(req.id, err);
+        if (err.code === "ENOENT") {
+          // no such file
+          cache.remove_hash(req.id, userId);
+        }
+      }
       if (image) {
       if (image) {
         callback({
         callback({
           status: status,
           status: status,