Return a nicer error if the file name is too long; closes pterodactyl/panel#2403
This commit is contained in:
parent
f0a4efb242
commit
897c4869de
|
@ -156,6 +156,13 @@ func putServerRenameFiles(c *gin.Context) {
|
|||
return
|
||||
}
|
||||
|
||||
if strings.HasSuffix(err.Error(), "file name too long") {
|
||||
c.AbortWithStatusJSON(http.StatusBadRequest, gin.H{
|
||||
"error": "Cannot move or rename file, name is too long.",
|
||||
})
|
||||
return
|
||||
}
|
||||
|
||||
TrackedServerError(err, s).AbortWithServerError(c)
|
||||
return
|
||||
}
|
||||
|
@ -254,6 +261,13 @@ func postServerWriteFile(c *gin.Context) {
|
|||
return
|
||||
}
|
||||
|
||||
if strings.HasSuffix(err.Error(), "file name too long") {
|
||||
c.AbortWithStatusJSON(http.StatusBadRequest, gin.H{
|
||||
"error": "Cannot move or rename file, name is too long.",
|
||||
})
|
||||
return
|
||||
}
|
||||
|
||||
TrackedServerError(err, s).AbortWithServerError(c)
|
||||
return
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user