Skip to content

Commit

Permalink
fix: iOS Bad URL fix
Browse files Browse the repository at this point in the history
  • Loading branch information
stravo1 committed May 20, 2024
1 parent ca94a73 commit b18ad17
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 6 deletions.
12 changes: 6 additions & 6 deletions actions.js
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ const getFilesList = async (accessToken, vault) => {
url:
"https://www.googleapis.com/drive/v3/files" +
(vault != null
? `?q='${vault}'%20in%20parents&fields=files(name, modifiedTime, mimeType, id)&pageSize=1000`
? `?q='${vault}'%20in%20parents&fields=files(name%2CmodifiedTime%2CmimeType%2Cid)&pageSize=1000`
: ""),
method: "GET",
headers: {
Expand All @@ -185,7 +185,7 @@ const getFilesList = async (accessToken, vault) => {
url:
"https://www.googleapis.com/drive/v3/files" +
(vault != null
? `?q='${vault}'%20in%20parents&fields=files(name, modifiedTime, mimeType, id)&pageSize=1000`
? `?q='${vault}'%20in%20parents&fields=files(name%2CmodifiedTime%2CmimeType%2Cid)&pageSize=1000`
: "") +
`&pageToken=${nextPageToken}`,
method: "GET",
Expand All @@ -210,8 +210,8 @@ const getFoldersList = async (accessToken, vault = null) => {
try {
const response = await requestUrl({
url:
"https://www.googleapis.com/drive/v3/files?q=mimeType%20%3D%20'application%2Fvnd.google-apps.folder'" +
(vault != null ? `%20and%20'${vault}'%20in%20parents` : "") + "&fields=files(name, id)&orderBy=createdTime&pageSize=1000",
"https://www.googleapis.com/drive/v3/files?q=mimeType%3D%27application%2Fvnd.google-apps.folder%27" +
(vault != null ? `%20and%20'${vault}'%20in%20parents` : "") + "&fields=files(name%2Cid)&orderBy=createdTime&pageSize=1000",
method: "GET",
headers: {
Authorization: `Bearer ${accessToken}`,
Expand All @@ -225,8 +225,8 @@ const getFoldersList = async (accessToken, vault = null) => {
while (isNextPageAvailable) {
const response = await requestUrl({
url:
"https://www.googleapis.com/drive/v3/files?q=mimeType%20%3D%20'application%2Fvnd.google-apps.folder'" +
(vault != null ? `%20and%20'${vault}'%20in%20parents` : "") + "&fields=files(name, id)&orderBy=createdTime%20desc&pageSize=1000" +
"https://www.googleapis.com/drive/v3/files?q=mimeType%3D%27application%2Fvnd.google-apps.folder%27" +
(vault != null ? `%20and%20'${vault}'%20in%20parents` : "") + "&fields=files(name%2Cid)&orderBy=createdTime&pageSize=1000" +
`&pageToken=${nextPageToken}`,
method: "GET",
headers: {
Expand Down
15 changes: 15 additions & 0 deletions main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -754,6 +754,7 @@ export default class driveSyncPlugin extends Plugin {
};

checkAndEmptySyncQueue = async () => {
if (this.haltAllOperations) return;
await this.writeToVerboseLogFile(
"LOG: Entering checkAndEmptySyncQueue"
);
Expand Down Expand Up @@ -1080,8 +1081,17 @@ export default class driveSyncPlugin extends Plugin {
}
} catch (err) {
await this.notifyError();
await this.writeToVerboseLogFile(
"FATAL ERROR: Could not fetch rootFolder"
);
await this.writeToErrorLogFile(err);
await this.writeToErrorLogFile(
new Error("FATAL ERROR: Could not fetch rootFolder")
);
new Notice("FATAL ERROR: Could not fetch rootFolder");
await this.writeToVerboseLogFile("LOG: adding settings UI");
this.addSettingTab(new syncSettings(this.app, this));
return;
}
// else {
// // accessToken is not available
Expand All @@ -1102,7 +1112,12 @@ export default class driveSyncPlugin extends Plugin {
new Notice(
"FATAL ERROR: Couldn't get VaultID from Google Drive :("
);
await this.writeToVerboseLogFile(
"FATAL ERROR: Couldn't get VaultID from Google Drive :("
);
new Notice("Check internet connection and restart plugin.");
await this.writeToVerboseLogFile("LOG: adding settings UI");
this.addSettingTab(new syncSettings(this.app, this));
return;
}
if (this.settings.vaultId == "NOT FOUND") {
Expand Down

0 comments on commit b18ad17

Please sign in to comment.