Browse Source

Ajout retour quand fichier introuvable

Loquicom 5 năm trước cách đây
mục cha
commit
6dad0270a0
1 tập tin đã thay đổi với 6 bổ sung1 xóa
  1. 6 1
      node/src/db.js

+ 6 - 1
node/src/db.js

@@ -131,7 +131,12 @@ Db.prototype.getFile = function (username, fileId) {
                 }
                 resolve(false);
             } else {
-                resolve(rows[0]);
+                // Regarde si il y a des resultat
+                if (rows.length > 0) {
+                    resolve(rows[0]);
+                } else {
+                    resolve(null);
+                }
             }
         });
     });