mirror of
https://github.com/restic/rest-server.git
synced 2025-12-06 17:15:45 -08:00
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:
@@ -12,6 +12,7 @@ import (
|
||||
"os"
|
||||
"path/filepath"
|
||||
"regexp"
|
||||
"runtime"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
@@ -637,6 +638,11 @@ func (h *Handler) saveBlob(w http.ResponseWriter, r *http.Request) {
|
||||
}
|
||||
|
||||
func syncDir(dirname string) error {
|
||||
if runtime.GOOS == "windows" {
|
||||
// syncing a directory is not possible on windows
|
||||
return nil
|
||||
}
|
||||
|
||||
dir, err := os.Open(dirname)
|
||||
if err != nil {
|
||||
return err
|
||||
|
||||
Reference in New Issue
Block a user