Avoid filepath.Dir as it returns paths with back slashes on Windows

This commit is contained in:
Gilbert Chen
2018-06-07 16:00:39 -04:00
parent 7e021f26d3
commit 9ae306644d

View File

@@ -18,7 +18,6 @@ import (
"math/rand"
"net/http"
//"net/http/httputil"
"path/filepath"
"strconv"
"sync"
"time"
@@ -360,11 +359,12 @@ func (storage *WebDAVStorage) MoveFile(threadIndex int, from string, to string)
// createParentDirectory creates the parent directory if it doesn't exist in the cache
func (storage *WebDAVStorage) createParentDirectory(threadIndex int, dir string) (err error) {
parent := filepath.Dir(dir)
if parent == "." {
found := strings.LastIndex(dir, "/")
if found == -1 {
return nil
}
parent := dir[:found]
storage.directoryCacheLock.Lock()
_, exist := storage.directoryCache[parent]