You've already forked CasaOS
mirror of
https://github.com/IceWhaleTech/CasaOS.git
synced 2025-07-15 23:54:17 +02:00
Add judgment on mount points (#921)
This commit is contained in:
@ -207,12 +207,15 @@ func DeleteSambaConnections(c *gin.Context) {
|
|||||||
}
|
}
|
||||||
baseHostPath := "/mnt/" + connection.Host
|
baseHostPath := "/mnt/" + connection.Host
|
||||||
for _, v := range mountPointList {
|
for _, v := range mountPointList {
|
||||||
err := service.MyService.Connections().UnmountSmaba(baseHostPath + "/" + v)
|
if service.IsMounted(baseHostPath + "/" + v) {
|
||||||
if err != nil {
|
err := service.MyService.Connections().UnmountSmaba(baseHostPath + "/" + v)
|
||||||
logger.Error("unmount smaba error", zap.Error(err), zap.Any("path", baseHostPath+"/"+v))
|
if err != nil {
|
||||||
c.JSON(common_err.SERVICE_ERROR, model.Result{Success: common_err.SERVICE_ERROR, Message: common_err.GetMsg(common_err.SERVICE_ERROR), Data: err.Error()})
|
logger.Error("unmount smaba error", zap.Error(err), zap.Any("path", baseHostPath+"/"+v))
|
||||||
return
|
c.JSON(common_err.SERVICE_ERROR, model.Result{Success: common_err.SERVICE_ERROR, Message: common_err.GetMsg(common_err.SERVICE_ERROR), Data: err.Error()})
|
||||||
|
return
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
dir, _ := ioutil.ReadDir(connection.MountPoint)
|
dir, _ := ioutil.ReadDir(connection.MountPoint)
|
||||||
if len(dir) == 0 {
|
if len(dir) == 0 {
|
||||||
|
Reference in New Issue
Block a user