mirror of
https://github.com/IceWhaleTech/CasaOS.git
synced 2025-08-29 00:29:39 +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
|
||||
for _, v := range mountPointList {
|
||||
if service.IsMounted(baseHostPath + "/" + v) {
|
||||
err := service.MyService.Connections().UnmountSmaba(baseHostPath + "/" + v)
|
||||
if err != nil {
|
||||
logger.Error("unmount smaba error", zap.Error(err), zap.Any("path", baseHostPath+"/"+v))
|
||||
@ -214,6 +215,8 @@ func DeleteSambaConnections(c *gin.Context) {
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
dir, _ := ioutil.ReadDir(connection.MountPoint)
|
||||
if len(dir) == 0 {
|
||||
os.RemoveAll(connection.MountPoint)
|
||||
|
Loading…
x
Reference in New Issue
Block a user