1
0
mirror of https://github.com/gilbertchen/duplicacy synced 2025-12-14 07:13:30 +00:00

Revert last commit which was checked in to the wrong branch

This reverts commit 3255d8168a.
This commit is contained in:
Gilbert Chen
2019-02-26 13:55:20 -05:00
parent 3255d8168a
commit 54c4ebaa99

View File

@@ -49,7 +49,7 @@ var (
) )
func CreateWebDAVStorage(host string, port int, username string, password string, storageDir string, useHTTP bool, threads int) (storage *WebDAVStorage, err error) { func CreateWebDAVStorage(host string, port int, username string, password string, storageDir string, useHTTP bool, threads int) (storage *WebDAVStorage, err error) {
if len(storageDir) > 0 && storageDir[len(storageDir)-1] != '/' { if storageDir[len(storageDir)-1] != '/' {
storageDir += "/" storageDir += "/"
} }
@@ -59,7 +59,7 @@ func CreateWebDAVStorage(host string, port int, username string, password string
username: username, username: username,
password: password, password: password,
storageDir: "", storageDir: "",
useHTTP: useHTTP, useHTTP: false,
client: http.DefaultClient, client: http.DefaultClient,
threads: threads, threads: threads,
@@ -313,7 +313,6 @@ func (storage *WebDAVStorage) ListFiles(threadIndex int, dir string) (files []st
// GetFileInfo returns the information about the file or directory at 'filePath'. // GetFileInfo returns the information about the file or directory at 'filePath'.
func (storage *WebDAVStorage) GetFileInfo(threadIndex int, filePath string) (exist bool, isDir bool, size int64, err error) { func (storage *WebDAVStorage) GetFileInfo(threadIndex int, filePath string) (exist bool, isDir bool, size int64, err error) {
properties, err := storage.getProperties(filePath, 0, "getcontentlength", "resourcetype") properties, err := storage.getProperties(filePath, 0, "getcontentlength", "resourcetype")
if err != nil { if err != nil {
if err == errWebDAVNotExist { if err == errWebDAVNotExist {
@@ -326,14 +325,7 @@ func (storage *WebDAVStorage) GetFileInfo(threadIndex int, filePath string) (exi
return false, false, 0, err return false, false, 0, err
} }
m, exist := properties["/"+storage.storageDir+filePath] if m, exist := properties["/"+storage.storageDir+filePath]; !exist {
// If no properties exist for the given filePath, remove the trailing / from filePath and search again
if !exist && filePath != "" && filePath[len(filePath) - 1] == '/' {
m, exist = properties["/"+storage.storageDir+filePath[:len(filePath) - 1]]
}
if !exist {
return false, false, 0, nil return false, false, 0, nil
} else if resourceType, exist := m["resourcetype"]; exist && strings.Contains(resourceType, "collection") { } else if resourceType, exist := m["resourcetype"]; exist && strings.Contains(resourceType, "collection") {
return true, true, 0, nil return true, true, 0, nil