Improve handling of upload to deleted folder (#16738)

GitOrigin-RevId: 2ad2890f8fe51f3c7c7a8ac0834059ea9cb0557b
This commit is contained in:
Alf Eaton
2024-01-29 09:03:23 +00:00
committed by Copybot
parent bb0da73a36
commit fefec2c1bf
5 changed files with 20 additions and 0 deletions
@@ -653,6 +653,9 @@ const ProjectEntityUpdateHandler = {
{ project_id: projectId, element_id: folderId, type: 'folder' },
(error, folder, folderPath) => {
if (error != null) {
if (error instanceof Errors.NotFoundError && folder == null) {
return callback(new Error('folder_not_found'))
}
return callback(error)
}
if (folder == null) {
@@ -842,6 +845,9 @@ const ProjectEntityUpdateHandler = {
{ project_id: projectId, element_id: folderId, type: 'folder' },
(error, folder) => {
if (error != null) {
if (error instanceof Errors.NotFoundError && folder == null) {
return callback(new Error('folder_not_found'))
}
return callback(error)
}
if (folder == null) {
@@ -120,6 +120,11 @@ module.exports = ProjectUploadController = {
success: false,
error: 'project_has_too_many_files',
})
} else if (error.message === 'folder_not_found') {
return res.status(422).json({
success: false,
error: 'folder_not_found',
})
} else {
return res.status(422).json({ success: false })
}