fix supabase url and ios issue#76
Merged
Merged
Conversation
✅ Deploy Preview for pb-placement ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
There was a problem hiding this comment.
Pull request overview
This PR introduces a resume “view” proxy endpoint and updates the UI/middleware to (1) avoid exposing the raw Supabase storage URL to end-users and (2) improve resume opening behavior on Safari/iOS (where popups are often blocked).
Changes:
- Added
/api/resume/view/[memberId]to proxy resume PDF access through the app domain. - Updated resume UI to use the proxy URL and to open resumes differently on mobile/iOS vs desktop (modal iframe).
- Updated middleware and export endpoint to account for the new proxy route.
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 6 comments.
Show a summary per file
| File | Description |
|---|---|
| middleware.ts | Bypasses auth redirects for the new resume proxy route. |
| components/profile/resume-section.tsx | Uses proxy URL for viewing/downloading resumes; adds mobile/iOS handling logic. |
| app/profile/[id]/page.tsx | Passes userId into ResumeSection to enable proxy URL construction. |
| app/api/resume/view/[memberId]/route.ts | New proxy endpoint that fetches the upstream resume and serves it with PDF headers. |
| app/api/export/pdf/route.ts | Returns the proxy URL instead of the raw member.resume_url. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
23
to
+27
| const pathname = req.nextUrl.pathname; | ||
|
|
||
| if (pathname.startsWith('/api/resume/view')) { | ||
| return res; | ||
| } |
Comment on lines
462
to
465
| <ResumeModal | ||
| resumeUrl={file.publicUrl} | ||
| fileName={file.name} | ||
| resumeUrl={userId ? `/api/resume/view/${userId}` : file.publicUrl} | ||
| displayName={displayFileName || file.name} | ||
| /> |
Comment on lines
467
to
469
| <Button variant="ghost" size="sm" asChild> | ||
| <a href={file.publicUrl} download={displayFileName || file.name}> | ||
| <a href={userId ? `/api/resume/view/${userId}` : file.publicUrl} download={displayFileName || file.name}> | ||
| <Download className="h-4 w-4" /> |
Comment on lines
+37
to
+41
| if (!member || !resumeUrl) { | ||
| return NextResponse.json({ message: 'Resume not found' }, { status: 404 }); | ||
| } | ||
|
|
||
| const upstream = await fetch(resumeUrl); |
Comment on lines
+46
to
+53
| let filename = 'resume.pdf'; | ||
| try { | ||
| const url = new URL(resumeUrl); | ||
| const pathParts = url.pathname.split('/'); | ||
| const lastPart = pathParts[pathParts.length - 1]; | ||
| if (lastPart && lastPart.includes('.pdf')) { | ||
| filename = lastPart; | ||
| } else { |
Comment on lines
+15
to
+23
| export async function HEAD(_req: NextRequest, { params }: { params: { memberId: string } }) { | ||
| try { | ||
| const { memberId } = params; | ||
| if (!memberId) return new NextResponse(null, { status: 400 }); | ||
|
|
||
| const { resumeUrl } = await getMemberAndUrl(memberId); | ||
| if (!resumeUrl) return new NextResponse(null, { status: 404 }); | ||
|
|
||
| return new NextResponse(null, { status: 200 }); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary: What does this PR do?
Resume was not opening in Safari browser as it was opening as a popup and popups are blocked in safari by default. Also, when someone opens a resume, the supabase url was visible which is not a good thing.
Fixed these issues.
Which issue(s) this PR fixes:
Changes Made
Describe the changes you've made in this PR:
Type of Change
How Has This Been Tested?
Describe the tests you ran:
Please describe the test cases and expected behavior:
1.
2.
Screenshots (if applicable)
Dependencies
Documentation
Comments:
Reviewer Notes