mirror of
https://github.com/BobbyWibowo/lolisafe.git
synced 2024-12-14 00:16:21 +00:00
Updated uploadController.js
Better snekfetch's error handling, probably.
This commit is contained in:
parent
57834dd362
commit
9396a9ab49
@ -216,7 +216,8 @@ uploadsController.actuallyUploadByUrl = async (req, res, user, albumid) => {
|
||||
}
|
||||
|
||||
const head = await snekfetch.head(url)
|
||||
.catch(erred)
|
||||
.catch(error => error)
|
||||
if (head.status !== 200) { return erred(head.toString()) }
|
||||
if (!head) { return }
|
||||
|
||||
const size = parseInt(head.headers['content-length'])
|
||||
@ -228,7 +229,8 @@ uploadsController.actuallyUploadByUrl = async (req, res, user, albumid) => {
|
||||
}
|
||||
|
||||
const download = await snekfetch.get(url)
|
||||
.catch(erred)
|
||||
.catch(error => error)
|
||||
if (download.status !== 200) { return erred(download.toString()) }
|
||||
if (!download) { return }
|
||||
|
||||
const length = uploadsController.getFileNameLength(req)
|
||||
|
Loading…
Reference in New Issue
Block a user