Skip to content

Commit

Permalink
Allow storage.googleapis.com URLS that start with takeout-
Browse files Browse the repository at this point in the history
  • Loading branch information
nelsonjchen committed Jun 12, 2023
1 parent afb01c8 commit fee8ad0
Showing 1 changed file with 13 additions and 5 deletions.
18 changes: 13 additions & 5 deletions src/handler.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import {proxyPathnameToAzBlobSASUrl} from './azb'
import {serializeError} from 'serialize-error';
import { proxyPathnameToAzBlobSASUrl } from './azb'
import { serializeError } from 'serialize-error';


export async function handleRequest(request: Request): Promise<Response> {
Expand Down Expand Up @@ -125,8 +125,16 @@ export function validTestServerURL(url: URL): boolean {

export function validGoogleTakeoutUrl(url: URL): boolean {
return (
url.hostname.endsWith('apidata.googleusercontent.com') &&
(url.pathname.startsWith('/download/storage/v1/b/dataliberation/o/') ||
url.pathname.startsWith('/download/storage/v1/b/takeout'))
(
url.hostname.endsWith('apidata.googleusercontent.com') &&
(
url.pathname.startsWith('/download/storage/v1/b/dataliberation/o/') ||
url.pathname.startsWith('/download/storage/v1/b/takeout')
)
) ||
(
url.hostname.endsWith('storage.googleapis.com') &&
url.pathname.startsWith('/takeout-')
)
)
}

0 comments on commit fee8ad0

Please sign in to comment.