chore: clarify delete by path prefix function name
parent
5ad0c05dfa
commit
49698b3df0
|
@ -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)
|
||||
|
|
|
@ -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)
|
||||
}
|
||||
|
|
|
@ -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})
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue