mirror of
https://github.com/restic/rest-server.git
synced 2025-10-19 15:43:21 +00: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:
parent
2175029c9e
commit
ec0766cddd
1 changed files with 6 additions and 0 deletions
|
@ -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
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue