MCPcopy
hub / github.com/filebrowser/filebrowser / GetByHash

Method GetByHash

share/storage.go:72–86  ·  view source on GitHub ↗

GetByHash wraps a StorageBackend.GetByHash.

(hash string)

Source from the content-addressed store, hash-verified

70
71// GetByHash wraps a StorageBackend.GetByHash.
72func (s *Storage) GetByHash(hash string) (*Link, error) {
73 link, err := s.back.GetByHash(hash)
74 if err != nil {
75 return nil, err
76 }
77
78 if link.Expire != 0 && link.Expire <= time.Now().Unix() {
79 if err := s.Delete(link.Hash); err != nil {
80 return nil, err
81 }
82 return nil, fberrors.ErrNotExist
83 }
84
85 return link, nil
86}
87
88// GetPermanent wraps a StorageBackend.GetPermanent
89func (s *Storage) GetPermanent(path string, id uint) (*Link, error) {

Callers

nothing calls this directly

Calls 2

DeleteMethod · 0.95
GetByHashMethod · 0.65

Tested by

no test coverage detected