Sfoglia il codice sorgente

Correction generation hash sans /

Loquicom 5 anni fa
parent
commit
484d77644d
2 ha cambiato i file con 2 aggiunte e 2 eliminazioni
  1. 1 1
      node/src/db.js
  2. 1 1
      node/src/route.js

+ 1 - 1
node/src/db.js

@@ -162,7 +162,7 @@ Db.prototype.addFile = function (username, filename, data) {
                 //Calcul du hash
                 let hash = fileId + '-' + username + '-' + filename;
                 hash = crypto.createHash('md5').update(hash).digest('base64');
-                hash = hash.replace(/=/g, '');
+                hash = hash.replace(/=/g, '').replace(/\//g, '');
                 // Ajoute le hash
                 this._execute(sql.addFileHash, [hash, fileId]);
                 // Recupération de l'utilisateur

+ 1 - 1
node/src/route.js

@@ -171,7 +171,7 @@ app.post('/save/:file', [verbose, verifyAuth, (req, res) => {
     if (global.storage === 'file') {
         let hash = Date.now() + '-' + req.body.user + '-' + req.params.file;
         hash = crypto.createHash('md5').update(hash).digest('base64');
-        hash = hash.replace(/=/g, '');
+        hash = hash.replace(/=/g, '').replace(/\//g, '');
         data = './data/' + hash + '.fdata';
     }
     let promise = db.addFile(req.body.user, req.params.file, data);