chore: fix typo
This commit is contained in:
parent
b73dce33aa
commit
d31faabc24
@ -9,8 +9,8 @@ import (
|
|||||||
log "github.com/sirupsen/logrus"
|
log "github.com/sirupsen/logrus"
|
||||||
)
|
)
|
||||||
|
|
||||||
// the param named path of functions in this package is a virtual path
|
// the param named path of functions in this package is a mount path
|
||||||
// So, the purpose of this package is to convert virtual path to actual path
|
// So, the purpose of this package is to convert mount path to actual path
|
||||||
// then pass the actual path to the op package
|
// then pass the actual path to the op package
|
||||||
|
|
||||||
func List(ctx context.Context, path string, refresh ...bool) ([]model.Obj, error) {
|
func List(ctx context.Context, path string, refresh ...bool) ([]model.Obj, error) {
|
||||||
|
@ -21,7 +21,7 @@ func ActualPath(storage driver.Additional, rawPath string) string {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// GetStorageAndActualPath Get the corresponding storage and actual path
|
// GetStorageAndActualPath Get the corresponding storage and actual path
|
||||||
// for path: remove the virtual path prefix and join the actual root folder if exists
|
// for path: remove the mount path prefix and join the actual root folder if exists
|
||||||
func GetStorageAndActualPath(rawPath string) (driver.Driver, string, error) {
|
func GetStorageAndActualPath(rawPath string) (driver.Driver, string, error) {
|
||||||
rawPath = utils.StandardizePath(rawPath)
|
rawPath = utils.StandardizePath(rawPath)
|
||||||
if strings.Contains(rawPath, "..") {
|
if strings.Contains(rawPath, "..") {
|
||||||
|
@ -24,7 +24,7 @@ var storagesMap generic_sync.MapOf[string, driver.Driver]
|
|||||||
func GetStorageByVirtualPath(virtualPath string) (driver.Driver, error) {
|
func GetStorageByVirtualPath(virtualPath string) (driver.Driver, error) {
|
||||||
storageDriver, ok := storagesMap.Load(virtualPath)
|
storageDriver, ok := storagesMap.Load(virtualPath)
|
||||||
if !ok {
|
if !ok {
|
||||||
return nil, errors.Errorf("no virtual path for an storage is: %s", virtualPath)
|
return nil, errors.Errorf("no mount path for an storage is: %s", virtualPath)
|
||||||
}
|
}
|
||||||
return storageDriver, nil
|
return storageDriver, nil
|
||||||
}
|
}
|
||||||
@ -154,7 +154,7 @@ func UpdateStorage(ctx context.Context, storage model.Storage) error {
|
|||||||
}
|
}
|
||||||
storageDriver, err := GetStorageByVirtualPath(oldStorage.MountPath)
|
storageDriver, err := GetStorageByVirtualPath(oldStorage.MountPath)
|
||||||
if oldStorage.MountPath != storage.MountPath {
|
if oldStorage.MountPath != storage.MountPath {
|
||||||
// virtual path renamed, need to drop the storage
|
// mount path renamed, need to drop the storage
|
||||||
storagesMap.Delete(oldStorage.MountPath)
|
storagesMap.Delete(oldStorage.MountPath)
|
||||||
}
|
}
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user