mirror of
https://github.com/BobbyWibowo/lolisafe.git
synced 2024-12-14 00:16:21 +00:00
Fixed last night's fuckup
This commit is contained in:
parent
80117235f9
commit
ad4eeb5eaa
@ -62,6 +62,12 @@ uploadsController.upload = function(req, res, next) {
|
|||||||
album = req.params.albumid
|
album = req.params.albumid
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
A rewrite is due so might as well do awful things here and fix them later :bloblul:
|
||||||
|
*/
|
||||||
|
|
||||||
|
if (album !== undefined && userid !== undefined) {
|
||||||
|
// If both values are present, check if the album owner is the user uploading
|
||||||
db.table('albums').where({ id: album, userid: userid }).then((albums) => {
|
db.table('albums').where({ id: album, userid: userid }).then((albums) => {
|
||||||
if (albums.length === 0) {
|
if (albums.length === 0) {
|
||||||
return res.json({
|
return res.json({
|
||||||
@ -69,7 +75,15 @@ uploadsController.upload = function(req, res, next) {
|
|||||||
description: 'Album doesn\'t exist or it doesn\'t belong to the user'
|
description: 'Album doesn\'t exist or it doesn\'t belong to the user'
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
uploadsController.actuallyUpload(req, res, userid, album);
|
||||||
|
})
|
||||||
|
} else {
|
||||||
|
uploadsController.actuallyUpload(req, res, userid, album);
|
||||||
|
}
|
||||||
|
}).catch(function(error) { console.log(error); res.json({ success: false, description: 'error' }) })
|
||||||
|
}
|
||||||
|
|
||||||
|
uploadsController.actuallyUpload = function(req, res, userid, album) {
|
||||||
upload(req, res, function (err) {
|
upload(req, res, function (err) {
|
||||||
if (err) {
|
if (err) {
|
||||||
console.error(err)
|
console.error(err)
|
||||||
@ -134,10 +148,7 @@ uploadsController.upload = function(req, res, next) {
|
|||||||
})
|
})
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
})
|
|
||||||
}).catch(function(error) { console.log(error); res.json({ success: false, description: 'error' }) })
|
|
||||||
}
|
}
|
||||||
|
|
||||||
uploadsController.processFilesForDisplay = function(req, res, files, existingFiles) {
|
uploadsController.processFilesForDisplay = function(req, res, files, existingFiles) {
|
||||||
|
|
||||||
let basedomain = req.get('host')
|
let basedomain = req.get('host')
|
||||||
|
Loading…
Reference in New Issue
Block a user