fix(files): disable auto renaming and clean path from request
This commit is contained in:
parent
4de972cb11
commit
0e77cfe335
8 changed files with 108 additions and 87 deletions
|
@ -79,7 +79,7 @@ func (bs *BoltStore) getUploadInfo(tx *bolt.Tx, userID uint64, itemPath string)
|
|||
|
||||
uploadInfoBucket := tx.Bucket([]byte(userUploadNS))
|
||||
if uploadInfoBucket == nil {
|
||||
return nil, bolt.ErrBucketNotFound
|
||||
return nil, db.ErrBucketNotFound
|
||||
|
||||
}
|
||||
|
||||
|
@ -169,6 +169,14 @@ func (bs *BoltStore) setFileInfo(tx *bolt.Tx, userID uint64, itemPath string, fi
|
|||
func (bs *BoltStore) AddUploadInfos(userID uint64, tmpPath, filePath string, info *db.FileInfo) error {
|
||||
return bs.boltdb.Update(func(tx *bolt.Tx) error {
|
||||
var err error
|
||||
|
||||
_, err = bs.getUploadInfo(tx, userID, tmpPath)
|
||||
if err == nil {
|
||||
return db.ErrKeyExisting
|
||||
} else if !errors.Is(err, db.ErrBucketNotFound) && !errors.Is(err, db.ErrKeyNotFound) {
|
||||
return err
|
||||
}
|
||||
|
||||
// check space quota
|
||||
userInfo, err := bs.getUserInfo(tx, userID)
|
||||
if err != nil {
|
||||
|
|
|
@ -31,6 +31,7 @@ var (
|
|||
ErrInvalidPreferences = errors.New("invalid preferences")
|
||||
ErrBucketNotFound = errors.New("bucket not found")
|
||||
ErrKeyNotFound = errors.New("key not found")
|
||||
ErrKeyExisting = errors.New("key is existing")
|
||||
ErrCreateExisting = errors.New("create upload info which already exists")
|
||||
ErrQuota = errors.New("quota limit reached")
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue