add HttpFS.Remove()
This commit is contained in:
@@ -2,7 +2,6 @@ package filestore
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
"strings"
|
||||
|
||||
"git.company.lan/gopkg/filestore/remote"
|
||||
)
|
||||
@@ -44,13 +43,18 @@ func NewHttpFS(dir string, opts ...HttpFSOption) (*HttpFS, error) {
|
||||
|
||||
// Open
|
||||
func (f *HttpFS) Open(name string) (http.File, error) {
|
||||
n := strings.TrimPrefix(name, "/")
|
||||
|
||||
if f.remoteStorage != nil {
|
||||
return f.remoteStorage.Open(name)
|
||||
}
|
||||
return f.localStorage.Open(name)
|
||||
}
|
||||
|
||||
return f.localStorage.Open(n)
|
||||
// Remove
|
||||
func (f *HttpFS) Remove(name string) error {
|
||||
if f.remoteStorage != nil {
|
||||
return f.remoteStorage.Remove(name)
|
||||
}
|
||||
return f.localStorage.Remove(name)
|
||||
}
|
||||
|
||||
// LocalStorage
|
||||
|
||||
Reference in New Issue
Block a user