Don't throw a 500 error if the backup is missing; closes pterodactyl/panel#2280

This commit is contained in:
Dane Everitt
2020-08-31 20:24:07 -07:00
parent 1e633ae302
commit 5f1d9ff151
3 changed files with 22 additions and 5 deletions

View File

@@ -2,6 +2,7 @@ package router
import (
"bufio"
"errors"
"github.com/gin-gonic/gin"
"github.com/pterodactyl/wings/router/tokens"
"github.com/pterodactyl/wings/server/backup"
@@ -28,7 +29,7 @@ func getDownloadBackup(c *gin.Context) {
b, st, err := backup.LocateLocal(token.BackupUuid)
if err != nil {
if os.IsNotExist(err) {
if errors.Is(err, os.ErrNotExist) {
c.AbortWithStatusJSON(http.StatusNotFound, gin.H{
"error": "The requested backup was not found on this server.",
})