mirror of
https://github.com/yu-i-i/overleaf-cep.git
synced 2026-11-15 14:43:46 +01:00
Only log unknown file upload errors (#16739)
GitOrigin-RevId: a6129e622ce32ea227f575b6d93616a7411391ed
This commit is contained in:
@@ -78,10 +78,6 @@ module.exports = ProjectUploadController = {
|
|||||||
const projectId = req.params.Project_id
|
const projectId = req.params.Project_id
|
||||||
const { folder_id: folderId } = req.query
|
const { folder_id: folderId } = req.query
|
||||||
if (name == null || name.length === 0 || name.length > 150) {
|
if (name == null || name.length === 0 || name.length > 150) {
|
||||||
logger.err(
|
|
||||||
{ projectId, fileName: name },
|
|
||||||
'bad name when trying to upload file'
|
|
||||||
)
|
|
||||||
return res.status(422).json({
|
return res.status(422).json({
|
||||||
success: false,
|
success: false,
|
||||||
error: 'invalid_filename',
|
error: 'invalid_filename',
|
||||||
@@ -100,16 +96,6 @@ module.exports = ProjectUploadController = {
|
|||||||
fs.unlink(path, function () {})
|
fs.unlink(path, function () {})
|
||||||
timer.done()
|
timer.done()
|
||||||
if (error != null) {
|
if (error != null) {
|
||||||
logger.error(
|
|
||||||
{
|
|
||||||
err: error,
|
|
||||||
projectId,
|
|
||||||
filePath: path,
|
|
||||||
fileName: name,
|
|
||||||
folderId,
|
|
||||||
},
|
|
||||||
'error uploading file'
|
|
||||||
)
|
|
||||||
if (error.name === 'InvalidNameError') {
|
if (error.name === 'InvalidNameError') {
|
||||||
return res.status(422).json({
|
return res.status(422).json({
|
||||||
success: false,
|
success: false,
|
||||||
@@ -126,6 +112,16 @@ module.exports = ProjectUploadController = {
|
|||||||
error: 'folder_not_found',
|
error: 'folder_not_found',
|
||||||
})
|
})
|
||||||
} else {
|
} else {
|
||||||
|
logger.error(
|
||||||
|
{
|
||||||
|
err: error,
|
||||||
|
projectId,
|
||||||
|
filePath: path,
|
||||||
|
fileName: name,
|
||||||
|
folderId,
|
||||||
|
},
|
||||||
|
'error uploading file'
|
||||||
|
)
|
||||||
return res.status(422).json({ success: false })
|
return res.status(422).json({ success: false })
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
Reference in New Issue
Block a user