mirror of
https://github.com/wgh136/nysoure.git
synced 2025-09-27 12:17:24 +00:00
Reject file uploads exceeding maximum size limit and delete rejected files
This commit is contained in:
@@ -511,6 +511,12 @@ func CreateServerDownloadTask(uid uint, url, filename, description string, resou
|
|||||||
return nil, model.NewInternalServerError("failed to create file in db")
|
return nil, model.NewInternalServerError("failed to create file in db")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if contentLength+getUploadingSize() > config.MaxUploadingSize() {
|
||||||
|
log.Info("A new downloading file is rejected due to max uploading size limit")
|
||||||
|
_ = dao.DeleteFile(file.UUID)
|
||||||
|
return nil, model.NewRequestError("server is busy, please try again later")
|
||||||
|
}
|
||||||
|
|
||||||
updateUploadingSize(contentLength)
|
updateUploadingSize(contentLength)
|
||||||
|
|
||||||
go func() {
|
go func() {
|
||||||
|
Reference in New Issue
Block a user