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)
|
importFile(URI string, next func(string, string) (interface{}, error)) (interface{}, error)
|
||||||
getFile(filename string, writer *bufio.Writer) error
|
getFile(filename string, writer *bufio.Writer) error
|
||||||
listDir(filename string) ([]string, error)
|
listDir(filename string) ([]string, error)
|
||||||
|
stat(filename string) (os.FileInfo, error)
|
||||||
}
|
}
|
||||||
|
|
||||||
var GlobalImporter Importer
|
var GlobalImporter Importer
|
||||||
|
@ -5,6 +5,7 @@ import (
|
|||||||
"errors"
|
"errors"
|
||||||
"net/http"
|
"net/http"
|
||||||
"net/url"
|
"net/url"
|
||||||
|
"os"
|
||||||
"path"
|
"path"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
@ -95,3 +96,7 @@ func (i CloudImporter) listDir(filename string) ([]string, error) {
|
|||||||
return res, nil
|
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
|
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