Fix report page: update allowed domains and repair image upload#20
Merged
Fix report page: update allowed domains and repair image upload#20
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Co-authored-by: ziggy-mc <213874544+ziggy-mc@users.noreply.github.com>
Copilot
AI
changed the title
[WIP] Update report page to use new links and remove old domain
Fix report page: update allowed domains and repair image upload
Mar 12, 2026
Copilot stopped work on behalf of
ziggy-mc due to an error
March 12, 2026 23:25
Copilot stopped work on behalf of
ziggy-mc due to an error
March 12, 2026 23:29
There was a problem hiding this comment.
Pull request overview
This PR updates the link-reporting flow by expanding the list of allowed short-link domains and changing how optional supporting images are attached to reports (switching from a missing upload endpoint to embedding image data in the report payload).
Changes:
- Update the report page and report API to allow additional service domains.
- Change report-image handling to convert the selected file to a base64 data URL and submit it inline.
- Increase the report API request body size limit to accommodate image data.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 6 comments.
| File | Description |
|---|---|
| pages/report.js | Updates allowed domains and changes client-side image handling to base64 + JSON submit. |
| pages/api/report/index.js | Updates allowed domains and increases body parser size limit for image payloads. |
Comments suppressed due to low confidence (1)
pages/report.js:104
await res.json()will throw if the API responds with a non-JSON body (common for 413 Payload Too Large or some proxy errors), and the catch then shows a generic "Network error". Consider parsing JSON defensively (fallback tores.text()), so users get an actionable error when uploads are rejected.
const res = await fetch("/api/report", {
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify({
reportedLink: reportedLink.trim(),
shortCode,
reason: reason.trim(),
imageUrl,
}),
});
const data = await res.json();
if (!res.ok) {
setError(data.error || "Failed to submit report. Please try again.");
} else {
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| import DSReport from "../../../models/DSReport"; | ||
|
|
||
| const ALLOWED_DOMAINS = ["zmcdsc.vercel.app", "dscs.ziggymc.me"]; | ||
| const ALLOWED_DOMAINS = ["dscs.ziggymc.me", "invs.ziggymc.me", "ds.ziggymc.me", "d.ziggymc.me"]; |
| export const config = { | ||
| api: { | ||
| bodyParser: { | ||
| sizeLimit: "6mb", |
Comment on lines
+8
to
+14
| export const config = { | ||
| api: { | ||
| bodyParser: { | ||
| sizeLimit: "6mb", | ||
| }, | ||
| }, | ||
| }; |
| import styles from "../styles/Report.module.css"; | ||
|
|
||
| const ALLOWED_DOMAINS = ["zmcdsc.vercel.app", "dscs.ziggymc.me"]; | ||
| const ALLOWED_DOMAINS = ["dscs.ziggymc.me", "invs.ziggymc.me", "ds.ziggymc.me", "d.ziggymc.me"]; |
| import styles from "../styles/Report.module.css"; | ||
|
|
||
| const ALLOWED_DOMAINS = ["zmcdsc.vercel.app", "dscs.ziggymc.me"]; | ||
| const ALLOWED_DOMAINS = ["dscs.ziggymc.me", "invs.ziggymc.me", "ds.ziggymc.me", "d.ziggymc.me"]; |
Comment on lines
+75
to
+86
| const MAX_IMAGE_BYTES = 4 * 1024 * 1024; | ||
| if (imageFile.size > MAX_IMAGE_BYTES) { | ||
| setError("Image must be 4 MB or smaller."); | ||
| setLoading(false); | ||
| return; | ||
| } | ||
| // If upload fails, proceed without image | ||
| imageUrl = await new Promise((resolve, reject) => { | ||
| const reader = new FileReader(); | ||
| reader.onload = () => resolve(reader.result); | ||
| reader.onerror = () => reject(new Error("Failed to read image file.")); | ||
| reader.readAsDataURL(imageFile); | ||
| }); |
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.
pages/404.jswith: "This short URL either expired or doesn't exist" message, spinner icon, "Redirecting..." text, 1.75s redirect to home pagepages/[code].jsto use{ notFound: true }instead of redirecting toPRIMARY_DOMAIN?error=notfound/?error=expired📱 Kick off Copilot coding agent tasks wherever you are with GitHub Mobile, available on iOS and Android.