Don't sync directory on Windows

Calling sync on a directory on Windows just returns "The handle is invalid"
and fails.
This commit is contained in:
Michael Eischer 2021-07-16 21:47:35 +02:00
parent 2175029c9e
commit ec0766cddd

View file

@ -12,6 +12,7 @@ import (
"os" "os"
"path/filepath" "path/filepath"
"regexp" "regexp"
"runtime"
"strings" "strings"
"time" "time"
@ -637,6 +638,11 @@ func (h *Handler) saveBlob(w http.ResponseWriter, r *http.Request) {
} }
func syncDir(dirname string) error { func syncDir(dirname string) error {
if runtime.GOOS == "windows" {
// syncing a directory is not possible on windows
return nil
}
dir, err := os.Open(dirname) dir, err := os.Open(dirname)
if err != nil { if err != nil {
return err return err