瀏覽代碼

create folder only when it does not exist

Gildas 3 年之前
父節點
當前提交
ebfdd62a1a
共有 1 個文件被更改,包括 6 次插入3 次删除
  1. 6 3
      src/core/bg/downloads.js

+ 6 - 3
src/core/bg/downloads.js

@@ -231,9 +231,12 @@ async function saveWithWebDAV(taskId, filename, content, url, username, password
 				for (const filenamePart of filenameParts) {
 					if (filenamePart) {
 						path += filenamePart;
-						const response = await sendRequest(url + path, "MKCOL");
-						if (response.status >= 400) {
-							throw new Error("Error " + response.status + " (WebDAV)");
+						const response = await sendRequest(url + path, "PROPFIND");
+						if (response.status == 404) {
+							const response = await sendRequest(url + path, "MKCOL");
+							if (response.status >= 400) {
+								throw new Error("Error " + response.status + " (WebDAV)");
+							}
 						}
 						path += "/";
 					}