chore: clarify delete by path prefix function name

pull/3896/head
Stavros Tsioulis 2025-07-02 18:53:27 +03:00 committed by Henrique Dias
parent 5ad0c05dfa
commit 49698b3df0
3 changed files with 6 additions and 6 deletions

View File

@ -73,7 +73,7 @@ func resourceDeleteHandler(fileCache FileCache) handleFunc {
return errToStatus(err), err
}
d.store.Share.DeleteWithPath(file.Path)
d.store.Share.DeleteWithPathPrefix(file.Path)
// delete thumbnails
err = delThumbs(r.Context(), fileCache, file)

View File

@ -15,7 +15,7 @@ type StorageBackend interface {
Gets(path string, id uint) ([]*Link, error)
Save(s *Link) error
Delete(hash string) error
DeleteWithPath(path string)
DeleteWithPathPrefix(path string)
}
// Storage is a storage.
@ -120,6 +120,6 @@ func (s *Storage) Delete(hash string) error {
return s.back.Delete(hash)
}
func (s *Storage) DeleteWithPath(path string) {
s.back.DeleteWithPath(path)
func (s *Storage) DeleteWithPathPrefix(path string) {
s.back.DeleteWithPathPrefix(path)
}

View File

@ -76,10 +76,10 @@ func (s shareBackend) Delete(hash string) error {
return err
}
func (s shareBackend) DeleteWithPath(pathPrefix string) {
func (s shareBackend) DeleteWithPathPrefix(pathPrefix string) {
var links []share.Link
s.db.Prefix("Path", pathPrefix, &links)
for _, link :=range links {
for _, link := range links {
s.db.DeleteStruct(&share.Link{Hash: link.Hash})
}
}