admin/sync: add stat method to importer
This commit is contained in:
parent
57758cd018
commit
db9077a85c
@ -23,6 +23,7 @@ type Importer interface {
|
||||
importFile(URI string, next func(string, string) (interface{}, error)) (interface{}, error)
|
||||
getFile(filename string, writer *bufio.Writer) error
|
||||
listDir(filename string) ([]string, error)
|
||||
stat(filename string) (os.FileInfo, error)
|
||||
}
|
||||
|
||||
var GlobalImporter Importer
|
||||
|
@ -5,6 +5,7 @@ import (
|
||||
"errors"
|
||||
"net/http"
|
||||
"net/url"
|
||||
"os"
|
||||
"path"
|
||||
"strings"
|
||||
|
||||
@ -95,3 +96,7 @@ func (i CloudImporter) listDir(filename string) ([]string, error) {
|
||||
return res, nil
|
||||
}
|
||||
}
|
||||
|
||||
func (i CloudImporter) stat(filename string) (os.FileInfo, error) {
|
||||
return gowebdav.NewClient(i.baseDAV.String(), i.username, i.password).Stat(strings.Replace(url.PathEscape(filename), "%2F", "/", -1))
|
||||
}
|
||||
|
@ -70,3 +70,7 @@ func (i LocalImporter) listDir(filename string) ([]string, error) {
|
||||
return res, nil
|
||||
}
|
||||
}
|
||||
|
||||
func (i LocalImporter) stat(filename string) (os.FileInfo, error) {
|
||||
return os.Stat(path.Join(i.Base, filename))
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user