Skip to content

Commit

Permalink
Exception handling when adding a mount to the same device (#890)
Browse files Browse the repository at this point in the history
  • Loading branch information
LinkLeong authored Feb 13, 2023
1 parent 86adfba commit 1a2f917
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions route/v1/recover.go
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,10 @@ func GetRecoverStorage(c *gin.Context) {
}
if cf["type"] == "drive" && cf["username"] == dmap["username"] {
c.String(200, `<p>The same configuration has been added</p><script>window.close()</script>`)
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)
Expand Down Expand Up @@ -147,7 +150,11 @@ func GetRecoverStorage(c *gin.Context) {
}
if cf["type"] == "dropbox" && cf["username"] == dmap["username"] {
c.String(200, `<p>The same configuration has been added</p><script>window.close()</script>`)
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)
Expand Down

0 comments on commit 1a2f917

Please sign in to comment.