Skip to content

Commit

Permalink
debug
Browse files Browse the repository at this point in the history
  • Loading branch information
vvo committed Jan 17, 2025
1 parent e4d010d commit aaa732b
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 2 deletions.
3 changes: 3 additions & 0 deletions packages/blob/src/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -412,6 +412,9 @@ async function retrieveClientToken(options: {
? handleUploadUrl
: toAbsoluteUrl(handleUploadUrl);

console.log('location.href', location.href);

Check failure on line 415 in packages/blob/src/client.ts

View workflow job for this annotation

GitHub Actions / ESLint

Unexpected console statement
console.log('url', url);

Check failure on line 416 in packages/blob/src/client.ts

View workflow job for this annotation

GitHub Actions / ESLint

Unexpected console statement

const event: GenerateClientTokenEvent = {
type: EventTypes.generateClientToken,
payload: {
Expand Down
4 changes: 4 additions & 0 deletions test/next/src/app/vercel/blob/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,10 @@ export default function Home(): JSX.Element {
<li>
Client Upload → <a href="/vercel/blob/app/client">/app/client</a>
</li>
<li>
Client Upload in a Web Worker →{' '}
<a href="/vercel/blob/app/client-webworker">/app/client-webworker</a>
</li>
<li>
Client Upload (multipart) →{' '}
<a href="/vercel/blob/app/client-multipart">/app/client-multipart</a>
Expand Down
4 changes: 3 additions & 1 deletion test/next/src/app/vercel/blob/validate-upload-token.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,14 @@ import type { IncomingMessage } from 'node:http';
export function validateUploadToken(
request: IncomingMessage | Request,
): boolean {
if (process.env.NODE_ENV === 'development') return true;
// if (process.env.NODE_ENV === 'development') return true;
const cookie =
'credentials' in request
? (request.headers.get('cookie') ?? '')
: (request.headers.cookie ?? '');

console.log('COOKIE', cookie);

return Boolean(
cookie &&
new RegExp(`clientUpload=${process.env.BLOB_UPLOAD_SECRET ?? ''}`).test(
Expand Down
2 changes: 1 addition & 1 deletion test/next/test/@vercel/blob/webworker.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ test('web worker upload', async ({ browser }) => {
await browserContext.addCookies([
{
name: 'clientUpload',
value: process.env.BLOB_UPLOAD_SECRET ?? '',
value: process.env.BLOB_UPLOAD_SECRET ?? 'YOYOYOYO',
path: '/',
domain: (process.env.PLAYWRIGHT_TEST_BASE_URL ?? 'localhost').replace(
'https://',
Expand Down

0 comments on commit aaa732b

Please sign in to comment.