Cleanup router/router_transfer.go

This commit is contained in:
Matthew Penner 2020-11-29 12:33:44 -07:00
parent a7a66e8bc0
commit 0c8476c79b

View File

@ -153,8 +153,7 @@ func postTransfer(c *gin.Context) {
} }
l.Info("server transfer failed, notifying panel") l.Info("server transfer failed, notifying panel")
err := api.New().SendTransferFailure(serverID) if err := api.New().SendTransferFailure(serverID); err != nil {
if err != nil {
if !api.IsRequestError(err) { if !api.IsRequestError(err) {
l.WithField("error", err).Error("failed to notify panel with transfer failure") l.WithField("error", err).Error("failed to notify panel with transfer failure")
return return
@ -201,8 +200,7 @@ func postTransfer(c *gin.Context) {
archivePath := filepath.Join(config.Get().System.ArchiveDirectory, serverID+".tar.gz") archivePath := filepath.Join(config.Get().System.ArchiveDirectory, serverID+".tar.gz")
// Check if the archive already exists and delete it if it does. // Check if the archive already exists and delete it if it does.
_, err = os.Stat(archivePath) if _, err = os.Stat(archivePath); err != nil {
if err != nil {
if !os.IsNotExist(err) { if !os.IsNotExist(err) {
l.WithField("error", err).Error("failed to stat archive file") l.WithField("error", err).Error("failed to stat archive file")
return return