mirror of
https://github.com/IceWhaleTech/CasaOS.git
synced 2025-08-29 08:39:44 +00:00
Add judgment on mount points (#921)
This commit is contained in:
parent
86a3692dad
commit
94755e221a
@ -207,6 +207,7 @@ func DeleteSambaConnections(c *gin.Context) {
|
|||||||
}
|
}
|
||||||
baseHostPath := "/mnt/" + connection.Host
|
baseHostPath := "/mnt/" + connection.Host
|
||||||
for _, v := range mountPointList {
|
for _, v := range mountPointList {
|
||||||
|
if service.IsMounted(baseHostPath + "/" + v) {
|
||||||
err := service.MyService.Connections().UnmountSmaba(baseHostPath + "/" + v)
|
err := service.MyService.Connections().UnmountSmaba(baseHostPath + "/" + v)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
logger.Error("unmount smaba error", zap.Error(err), zap.Any("path", baseHostPath+"/"+v))
|
logger.Error("unmount smaba error", zap.Error(err), zap.Any("path", baseHostPath+"/"+v))
|
||||||
@ -214,6 +215,8 @@ func DeleteSambaConnections(c *gin.Context) {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
}
|
||||||
dir, _ := ioutil.ReadDir(connection.MountPoint)
|
dir, _ := ioutil.ReadDir(connection.MountPoint)
|
||||||
if len(dir) == 0 {
|
if len(dir) == 0 {
|
||||||
os.RemoveAll(connection.MountPoint)
|
os.RemoveAll(connection.MountPoint)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user