cache file open bugfix
This commit is contained in:
parent
76a2f7d2db
commit
b69c78b380
2 changed files with 5 additions and 4 deletions
|
|
@ -199,14 +199,15 @@ func (fs *FS) Open(name string) (f http.File, err error) {
|
|||
f = &Dir{log: log.WithName("dir"), f: file, dc: fs.dc}
|
||||
return
|
||||
}
|
||||
md := fs.mh.Metadata(name, fi.Size())
|
||||
size := fi.Size()
|
||||
md := fs.mh.Metadata(name, size)
|
||||
|
||||
var cache provider.File
|
||||
if offline {
|
||||
log.V(2).Info("file offline mode")
|
||||
cache = file
|
||||
} else {
|
||||
cache, err = fs.dst.Open(name)
|
||||
cache, err = fs.openCacheFile(name, size)
|
||||
if err != nil {
|
||||
if !skipLog(name) {
|
||||
log.Error(err, "error opening cache file")
|
||||
|
|
|
|||
|
|
@ -48,7 +48,7 @@ func skipLog(path string) bool {
|
|||
func (fs *FileServer) ServeHTTP(w http.ResponseWriter, r *http.Request) {
|
||||
s := &statusInterceptor{w: w}
|
||||
w = s
|
||||
if !skipLog(r.RequestURI) {
|
||||
if !skipLog(r.URL.Path) {
|
||||
defer func() {
|
||||
if s.Status() == http.StatusPartialContent {
|
||||
return
|
||||
|
|
@ -57,7 +57,7 @@ func (fs *FileServer) ServeHTTP(w http.ResponseWriter, r *http.Request) {
|
|||
"client", r.RemoteAddr,
|
||||
"method", r.Method,
|
||||
"status", s.Status(),
|
||||
"uri", r.RequestURI,
|
||||
"uri", r.URL.Path,
|
||||
)
|
||||
}()
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue