From 1a2f917b30203e78e7ab8e721ddb4ab21557e80d Mon Sep 17 00:00:00 2001 From: link Date: Mon, 13 Feb 2023 19:42:34 +0800 Subject: [PATCH] Exception handling when adding a mount to the same device (#890) --- route/v1/recover.go | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/route/v1/recover.go b/route/v1/recover.go index a52982520..a0ec78a19 100644 --- a/route/v1/recover.go +++ b/route/v1/recover.go @@ -71,7 +71,10 @@ func GetRecoverStorage(c *gin.Context) { } if cf["type"] == "drive" && cf["username"] == dmap["username"] { c.String(200, `

The same configuration has been added

`) - service.MyService.Storage().CheckAndMountByName(cf["username"]) + err := service.MyService.Storage().CheckAndMountByName(v) + if err != nil { + logger.Error("check and mount by name error: ", zap.Error(err), zap.Any("name", cf["username"])) + } notify["status"] = "warn" notify["message"] = "The same configuration has been added" service.MyService.Notify().SendNotify("casaos:file:recover", notify) @@ -147,7 +150,11 @@ func GetRecoverStorage(c *gin.Context) { } if cf["type"] == "dropbox" && cf["username"] == dmap["username"] { c.String(200, `

The same configuration has been added

`) - service.MyService.Storage().CheckAndMountByName(cf["username"]) + err := service.MyService.Storage().CheckAndMountByName(v) + if err != nil { + logger.Error("check and mount by name error: ", zap.Error(err), zap.Any("name", cf["username"])) + } + notify["status"] = "warn" notify["message"] = "The same configuration has been added" service.MyService.Notify().SendNotify("casaos:file:recover", notify)