Refactor (storage): Comment out the path validation logic

- Comment out the error return logic for paths with "/"
- Remove storage path restrictions to allow for flexible handling of root paths
pull/9308/head
okatu-loli 2025-09-04 20:37:49 +08:00
parent 63391a2091
commit 68a731a412
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")