more debug for webdav and bump to 0.4.6
Some checks failed
Release A New Version / build (16.x) (push) Failing after 39s
Some checks failed
Release A New Version / build (16.x) (push) Failing after 39s
This commit is contained in:
parent
acc9233611
commit
fd095a9093
@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"id": "remotely-save",
|
"id": "remotely-save",
|
||||||
"name": "Remotely Save",
|
"name": "Remotely Save",
|
||||||
"version": "0.4.5",
|
"version": "0.4.6",
|
||||||
"minAppVersion": "0.13.21",
|
"minAppVersion": "0.13.21",
|
||||||
"description": "Yet another unofficial plugin allowing users to synchronize notes between local device and the cloud service.",
|
"description": "Yet another unofficial plugin allowing users to synchronize notes between local device and the cloud service.",
|
||||||
"author": "fyears",
|
"author": "fyears",
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "remotely-save",
|
"name": "remotely-save",
|
||||||
"version": "0.4.5",
|
"version": "0.4.6",
|
||||||
"description": "This is yet another sync plugin for Obsidian app.",
|
"description": "This is yet another sync plugin for Obsidian app.",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"dev2": "node esbuild.config.mjs --watch",
|
"dev2": "node esbuild.config.mjs --watch",
|
||||||
|
|||||||
@ -47,6 +47,11 @@ if (VALID_REQURL) {
|
|||||||
delete transformedHeaders["host"];
|
delete transformedHeaders["host"];
|
||||||
delete transformedHeaders["content-length"];
|
delete transformedHeaders["content-length"];
|
||||||
|
|
||||||
|
console.debug(`before request:`);
|
||||||
|
console.debug(`url: ${options.url}`);
|
||||||
|
console.debug(`method: ${options.method}`);
|
||||||
|
console.debug(`headers: ${JSON.stringify(transformedHeaders, null, 2)}`);
|
||||||
|
|
||||||
const r = await requestUrl({
|
const r = await requestUrl({
|
||||||
url: options.url,
|
url: options.url,
|
||||||
method: options.method,
|
method: options.method,
|
||||||
@ -67,9 +72,11 @@ if (VALID_REQURL) {
|
|||||||
contentType = contentType.toLowerCase();
|
contentType = contentType.toLowerCase();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
console.debug(`after request:`);
|
||||||
|
console.debug(`contentType: ${contentType}`);
|
||||||
|
|
||||||
const rspHeaders = objKeyToLower({ ...r.headers });
|
const rspHeaders = objKeyToLower({ ...r.headers });
|
||||||
console.log("rspHeaders");
|
console.debug(`rspHeaders: ${JSON.stringify(rspHeaders, null, 2)}`);
|
||||||
console.log(rspHeaders);
|
|
||||||
for (let key in rspHeaders) {
|
for (let key in rspHeaders) {
|
||||||
if (rspHeaders.hasOwnProperty(key)) {
|
if (rspHeaders.hasOwnProperty(key)) {
|
||||||
// avoid the error:
|
// avoid the error:
|
||||||
@ -86,6 +93,7 @@ if (VALID_REQURL) {
|
|||||||
// }
|
// }
|
||||||
// }
|
// }
|
||||||
if (!onlyAscii(rspHeaders[key])) {
|
if (!onlyAscii(rspHeaders[key])) {
|
||||||
|
console.debug(`rspHeaders[key] needs encode: ${key}`);
|
||||||
rspHeaders[key] = encodeURIComponent(rspHeaders[key]);
|
rspHeaders[key] = encodeURIComponent(rspHeaders[key]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -141,19 +149,21 @@ if (VALID_REQURL) {
|
|||||||
// }
|
// }
|
||||||
|
|
||||||
let r2: Response | undefined = undefined;
|
let r2: Response | undefined = undefined;
|
||||||
|
const statusText = getReasonPhrase(r.status);
|
||||||
|
console.debug(`statusText: ${statusText}`);
|
||||||
if ([101, 103, 204, 205, 304].includes(r.status)) {
|
if ([101, 103, 204, 205, 304].includes(r.status)) {
|
||||||
// A null body status is a status that is 101, 103, 204, 205, or 304.
|
// A null body status is a status that is 101, 103, 204, 205, or 304.
|
||||||
// https://fetch.spec.whatwg.org/#statuses
|
// https://fetch.spec.whatwg.org/#statuses
|
||||||
// fix this: Failed to construct 'Response': Response with null body status cannot have body
|
// fix this: Failed to construct 'Response': Response with null body status cannot have body
|
||||||
r2 = new Response(null, {
|
r2 = new Response(null, {
|
||||||
status: r.status,
|
status: r.status,
|
||||||
statusText: getReasonPhrase(r.status),
|
statusText: statusText,
|
||||||
headers: rspHeaders,
|
headers: rspHeaders,
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
r2 = new Response(r.arrayBuffer, {
|
r2 = new Response(r.arrayBuffer, {
|
||||||
status: r.status,
|
status: r.status,
|
||||||
statusText: getReasonPhrase(r.status),
|
statusText: statusText,
|
||||||
headers: rspHeaders,
|
headers: rspHeaders,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user