fix requrl for onedrive

This commit is contained in:
fyears 2022-04-16 18:53:40 +08:00
parent dd39e229d8
commit baf4e6b369

View File

@ -8,7 +8,7 @@ import type {
import cloneDeep from "lodash/cloneDeep"; import cloneDeep from "lodash/cloneDeep";
import { request, requestUrl, requireApiVersion, Vault } from "obsidian"; import { request, requestUrl, requireApiVersion, Vault } from "obsidian";
import { import {
API_VER_REQURL, VALID_REQURL,
COMMAND_CALLBACK_ONEDRIVE, COMMAND_CALLBACK_ONEDRIVE,
DEFAULT_CONTENT_TYPE, DEFAULT_CONTENT_TYPE,
OAUTH2_FORCE_EXPIRE_MILLISECONDS, OAUTH2_FORCE_EXPIRE_MILLISECONDS,
@ -484,7 +484,7 @@ export class WrappedOnedriveClient {
deleteJson = async (pathFragOrig: string) => { deleteJson = async (pathFragOrig: string) => {
const theUrl = this.buildUrl(pathFragOrig); const theUrl = this.buildUrl(pathFragOrig);
log.debug(`deleteJson, theUrl=${theUrl}`); log.debug(`deleteJson, theUrl=${theUrl}`);
if (requireApiVersion(API_VER_REQURL)) { if (VALID_REQURL) {
await requestUrl({ await requestUrl({
url: theUrl, url: theUrl,
method: "DELETE", method: "DELETE",
@ -508,7 +508,7 @@ export class WrappedOnedriveClient {
// TODO: // TODO:
// 20220401: On Android, requestUrl has issue that text becomes base64. // 20220401: On Android, requestUrl has issue that text becomes base64.
// Use fetch everywhere instead! // Use fetch everywhere instead!
if (false /*requireApiVersion(API_VER_REQURL)*/) { if (false /*VALID_REQURL*/) {
await requestUrl({ await requestUrl({
url: theUrl, url: theUrl,
method: "PUT", method: "PUT",
@ -556,7 +556,7 @@ export class WrappedOnedriveClient {
// TODO: // TODO:
// 20220401: On Android, requestUrl has issue that text becomes base64. // 20220401: On Android, requestUrl has issue that text becomes base64.
// Use fetch everywhere instead! // Use fetch everywhere instead!
if (false /*requireApiVersion(API_VER_REQURL)*/) { if (false /*VALID_REQURL*/) {
const res = await requestUrl({ const res = await requestUrl({
url: theUrl, url: theUrl,
method: "PUT", method: "PUT",
@ -808,7 +808,7 @@ const downloadFromRemoteRaw = async (
`${key}?$select=@microsoft.graph.downloadUrl` `${key}?$select=@microsoft.graph.downloadUrl`
); );
const downloadUrl: string = rsp["@microsoft.graph.downloadUrl"]; const downloadUrl: string = rsp["@microsoft.graph.downloadUrl"];
if (requireApiVersion(API_VER_REQURL)) { if (VALID_REQURL) {
const content = (await requestUrl({ url: downloadUrl })).arrayBuffer; const content = (await requestUrl({ url: downloadUrl })).arrayBuffer;
return content; return content;
} else { } else {