Refactor (storage): Comment out the path validation logic (#9308)

- Comment out the error return logic for paths with "/"
- Remove storage path restrictions to allow for flexible handling of root paths
pull/7757/merge
千石 2025-09-04 22:14:33 +08:00 committed by GitHub
parent 4b288a08ef
commit 23107483a1
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 6 additions and 6 deletions

View File

@ -47,9 +47,9 @@ func CreateStorage(ctx context.Context, storage model.Storage) (uint, error) {
storage.Modified = time.Now() storage.Modified = time.Now()
storage.MountPath = utils.FixAndCleanPath(storage.MountPath) storage.MountPath = utils.FixAndCleanPath(storage.MountPath)
if storage.MountPath == "/" { //if storage.MountPath == "/" {
return 0, errors.New("Mount path cannot be '/'") // return 0, errors.New("Mount path cannot be '/'")
} //}
var err error var err error
// check driver first // check driver first
@ -210,9 +210,9 @@ func UpdateStorage(ctx context.Context, storage model.Storage) error {
} }
storage.Modified = time.Now() storage.Modified = time.Now()
storage.MountPath = utils.FixAndCleanPath(storage.MountPath) storage.MountPath = utils.FixAndCleanPath(storage.MountPath)
if storage.MountPath == "/" { //if storage.MountPath == "/" {
return errors.New("Mount path cannot be '/'") // return errors.New("Mount path cannot be '/'")
} //}
err = db.UpdateStorage(&storage) err = db.UpdateStorage(&storage)
if err != nil { if err != nil {
return errors.WithMessage(err, "failed update storage in database") return errors.WithMessage(err, "failed update storage in database")