CasaOS - A simple, easy-to-use, elegant open-source Personal Cloud system.
Fix sharing failure issue (#884)
link7b07f2268542
diff --git a/pkg/utils/httper/drive.go b/pkg/utils/httper/drive.goindex 28b4c1b..0f25681 100644--- a/pkg/utils/httper/drive.go+++ b/pkg/utils/httper/drive.go@@ -17,12 +17,14 @@ type MountList struct {MountPoint string `json:"MountPoint"`Fs string `json:"Fs"`Icon string `json:"Icon"`+ Name string `json:"Name"`} `json:"mountPoints"`}type MountPoint struct {MountPoint string `json:"mount_point"`Fs string `json:"fs"`Icon string `json:"icon"`+ Name string `json:"name"`}type MountResult struct {Error string `json:"error"`@@ -77,6 +79,7 @@ func Mount(mountPoint string, fs string) error {res, err := NewRestyClient().R().SetFormData(map[string]string{"mountPoint": mountPoint,"fs": fs,+ "mountOpt": `{"AllowOther": true}`,}).Post("/mount/mount")if err != nil {return errdiff --git a/route/v1/recover.go b/route/v1/recover.goindex 02f96a3..a529825 100644--- a/route/v1/recover.go+++ b/route/v1/recover.go@@ -1,13 +1,13 @@package v1import (+ "strconv""strings""time""github.com/IceWhaleTech/CasaOS-Common/utils/logger""github.com/IceWhaleTech/CasaOS/drivers/dropbox""github.com/IceWhaleTech/CasaOS/drivers/google_drive"- fileutil "github.com/IceWhaleTech/CasaOS/pkg/utils/file""github.com/IceWhaleTech/CasaOS/service""github.com/gin-gonic/gin""go.uber.org/zap"@@ -82,13 +82,10 @@ func GetRecoverStorage(c *gin.Context) {a := strings.Split(username, "@")username = a[0]}- username = fileutil.NameAccumulation(username, "/mnt")- dataMap, _ := service.MyService.Storage().GetConfigByName(username)- if len(dataMap) > 0 {- service.MyService.Storage().UnmountStorage("/mnt/" + username)- service.MyService.Storage().DeleteConfigByName(username)- }+ //username = fileutil.NameAccumulation(username, "/mnt")+ username += "_google_drive_" + strconv.FormatInt(time.Now().Unix(), 10)+dmap["client_id"] = add.ClientIDdmap["client_secret"] = add.ClientSecretdmap["scope"] = "drive"@@ -161,13 +158,7 @@ func GetRecoverStorage(c *gin.Context) {a := strings.Split(username, "@")username = a[0]}- username = fileutil.NameAccumulation(username, "/mnt")- dataMap, _ := service.MyService.Storage().GetConfigByName(username)- if len(dataMap) > 0 {-- service.MyService.Storage().UnmountStorage("/mnt/" + username)- service.MyService.Storage().DeleteConfigByName(username)- }+ username += "_dropbox_" + strconv.FormatInt(time.Now().Unix(), 10)dmap["client_id"] = add.AppKeydmap["client_secret"] = add.AppSecretdiff --git a/route/v1/storage.go b/route/v1/storage.goindex 334b425..0c07235 100644--- a/route/v1/storage.go+++ b/route/v1/storage.go@@ -52,6 +52,7 @@ func ListStorages(c *gin.Context) {if dataMap["type"] == "dropbox" {r.MountPoints[i].Icon = dropbox.ICONURL}+ r.MountPoints[i].Name = dataMap["username"]}list := []httper.MountPoint{}@@ -60,6 +61,7 @@ func ListStorages(c *gin.Context) {Fs: v.Fs,Icon: v.Icon,MountPoint: v.MountPoint,+ Name: v.Name,})}diff --git a/service/storage.go b/service/storage.goindex 14e57ce..a13711e 100644--- a/service/storage.go+++ b/service/storage.go@@ -97,6 +97,7 @@ func (s *storageStruct) CheckAndMountAll() error {}return nil}+func (s *storageStruct) GetConfigByName(name string) (map[string]string, error) {return httper.GetConfigByName(name)}