mirror of
https://github.com/yu-i-i/overleaf-cep.git
synced 2026-05-23 17:19:37 +02: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 { folder_id: folderId } = req.query
|
||||
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({
|
||||
success: false,
|
||||
error: 'invalid_filename',
|
||||
@@ -100,16 +96,6 @@ module.exports = ProjectUploadController = {
|
||||
fs.unlink(path, function () {})
|
||||
timer.done()
|
||||
if (error != null) {
|
||||
logger.error(
|
||||
{
|
||||
err: error,
|
||||
projectId,
|
||||
filePath: path,
|
||||
fileName: name,
|
||||
folderId,
|
||||
},
|
||||
'error uploading file'
|
||||
)
|
||||
if (error.name === 'InvalidNameError') {
|
||||
return res.status(422).json({
|
||||
success: false,
|
||||
@@ -126,6 +112,16 @@ module.exports = ProjectUploadController = {
|
||||
error: 'folder_not_found',
|
||||
})
|
||||
} else {
|
||||
logger.error(
|
||||
{
|
||||
err: error,
|
||||
projectId,
|
||||
filePath: path,
|
||||
fileName: name,
|
||||
folderId,
|
||||
},
|
||||
'error uploading file'
|
||||
)
|
||||
return res.status(422).json({ success: false })
|
||||
}
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user