mirror of
https://github.com/BobbyWibowo/lolisafe.git
synced 2024-12-14 00:16:21 +00:00
Updated uploadController.js
The GET task of URL uploads will now limit the maximum size of the response body by the size reported in Content-Length header of the HEAD task. This relies on node-fetch's way of handling it. I don't know the magic behind it.
This commit is contained in:
parent
742ae43622
commit
4193921b4e
@ -261,7 +261,9 @@ uploadsController.actuallyUploadByUrl = async (req, res, user, albumid) => {
|
|||||||
return erred('File too large.')
|
return erred('File too large.')
|
||||||
}
|
}
|
||||||
|
|
||||||
const fetchFile = await fetch(url)
|
const fetchFile = await fetch(url, {
|
||||||
|
size // limit max response body size with content-length
|
||||||
|
})
|
||||||
if (fetchFile.status !== 200) {
|
if (fetchFile.status !== 200) {
|
||||||
return erred(`${fetchHead.status} ${fetchHead.statusText}`)
|
return erred(`${fetchHead.status} ${fetchHead.statusText}`)
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user