Skip to content

Commit

Permalink
Improve google url parser
Browse files Browse the repository at this point in the history
Resolves: mieweb/docs#41
  • Loading branch information
ggodlewski committed Oct 5, 2024
1 parent fce3068 commit 6cd462c
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/utils/idParsers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,13 +55,13 @@ export function urlToFolderId(url: string): string | null {
return null;
}

if (url.startsWith('https://docs.google.com/drawings/d/')) {
const id = url.substring(url.indexOf('docs.google.com/drawings/d/') + 'docs.google.com/drawings/d/'.length);
if (url.startsWith('https://docs.google.com/drawings/')) {
const id = url.split('/d/')[1];
return stripUrlSuffix(id);
}

if (url.indexOf('docs.google.com/document/d/') > 0) {
const id = url.substring(url.indexOf('docs.google.com/document/d/') + 'docs.google.com/document/d/'.length);
if (url.indexOf('docs.google.com/document/') > 0) {
const id = url.split('/d/')[1];
return stripUrlSuffix(id);
}

Expand Down

0 comments on commit 6cd462c

Please sign in to comment.