diff options
author | aunsane <aunsane@gmail.com> | 2018-04-26 13:20:48 +0300 |
---|---|---|
committer | aunsane <aunsane@gmail.com> | 2018-04-26 13:20:48 +0300 |
commit | 6bb961489e3cebf19d32c83df5126fe4ea73e37a (patch) | |
tree | 5ea585d454cffb61b2c113c1c681f575cff724bf | |
parent | 5d651e838c864347fc6a6276d637e4008dafd764 (diff) |
CloudFile: fix for #1298
-rw-r--r-- | plugins/CloudFile/src/Services/yandex_api.h | 2 | ||||
-rw-r--r-- | plugins/CloudFile/src/Services/yandex_service.cpp | 12 | ||||
-rw-r--r-- | plugins/CloudFile/src/file_transfer.h | 4 |
3 files changed, 14 insertions, 4 deletions
diff --git a/plugins/CloudFile/src/Services/yandex_api.h b/plugins/CloudFile/src/Services/yandex_api.h index 91db0290a1..ac99cb0177 100644 --- a/plugins/CloudFile/src/Services/yandex_api.h +++ b/plugins/CloudFile/src/Services/yandex_api.h @@ -99,7 +99,7 @@ namespace YandexAPI HttpRequest(REQUEST_PUT, YADISK_API) { AddOAuthHeader(token); - AddUrlParameter("path=app:%s", ptrA(mir_urlEncode(path))); + AddUrlParameterWithEncode("path", "app:%s", path); AddUrlParameter("fields=href"); } }; diff --git a/plugins/CloudFile/src/Services/yandex_service.cpp b/plugins/CloudFile/src/Services/yandex_service.cpp index ff99604aa4..1f87c14da5 100644 --- a/plugins/CloudFile/src/Services/yandex_service.cpp +++ b/plugins/CloudFile/src/Services/yandex_service.cpp @@ -200,7 +200,17 @@ void CYandexService::CreateFolder(const std::string &path) YandexAPI::CreateFolderRequest request(token, path.c_str()); NLHR_PTR response(request.Send(m_hConnection)); - GetJsonResponse(response); + if (HTTP_CODE_SUCCESS(response->resultCode)) { + GetJsonResponse(response); + return; + } + + // forder exists on server + if (response->resultCode == HTTP_CODE_CONFLICT) { + return; + } + + HttpResponseToError(response); } auto CYandexService::CreateSharedLink(const std::string &path) diff --git a/plugins/CloudFile/src/file_transfer.h b/plugins/CloudFile/src/file_transfer.h index 9918018ff0..95ce0aa120 100644 --- a/plugins/CloudFile/src/file_transfer.h +++ b/plugins/CloudFile/src/file_transfer.h @@ -14,7 +14,7 @@ private: CMStringW m_serverDirectory; int m_relativePathStart; - + LIST<char> m_links; CMStringW m_description; @@ -138,7 +138,7 @@ public: const bool IsCurrentFileInSubDirectory() const { - const wchar_t *backslash = wcschr(GetCurrentFilePath(), L'\\'); + const wchar_t *backslash = wcschr(GetCurrentRelativeFilePath(), L'\\'); return backslash != nullptr; } |