mirror of
https://github.com/BobbyWibowo/lolisafe.git
synced 2025-01-19 01:31:34 +00:00
Changed the way repeated files work
From now on, same file upload is restricted per user. Meaning same user cant upload the same file twice, and upon trying to do so they will get the original link instead of an updated one. This works the same way for anonymous uploads, only 1 file of the same kind will be uploaded
This commit is contained in:
parent
18c66d27fb
commit
6396d42409
@ -76,7 +76,14 @@ uploadsController.upload = function(req, res, next){
|
||||
stream.on('end', function () {
|
||||
let fileHash = hash.digest('hex') // 34f7a3113803f8ed3b8fd7ce5656ebec
|
||||
|
||||
db.table('files').where({
|
||||
db.table('files')
|
||||
.where(function(){
|
||||
if(userid === undefined)
|
||||
this.whereNull('userid')
|
||||
else
|
||||
this.where('userid', userid)
|
||||
})
|
||||
.where({
|
||||
hash: fileHash,
|
||||
size: file.size
|
||||
}).then((dbfile) => {
|
||||
|
Loading…
Reference in New Issue
Block a user