-
Notifications
You must be signed in to change notification settings - Fork 1
Feature | Redirection #10
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: staging
Are you sure you want to change the base?
Conversation
mukezhz
commented
Apr 9, 2025
- added support for redirection
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Copilot reviewed 66 out of 71 changed files in this pull request and generated 1 comment.
Files not reviewed (5)
- package.json: Language not supported
- pnpm-lock.yaml: Language not supported
- prisma/migrations/20250407063823_add_role_permissions/migration.sql: Language not supported
- prisma/migrations/20250409071302_add_redirect_url/migration.sql: Language not supported
- prisma/schema.prisma: Language not supported
Comments suppressed due to low confidence (1)
src/app/api/domain/add/route.ts:77
- [nitpick] Consider using consistent naming for redirection fields. The schema uses 'redirectTo' for the request payload, while the database and API response refer to it as 'redirectUrl'. Aligning these names could improve clarity.
redirectUrl: reqPayload.enableRedirection && reqPayload.redirectTo ? reqPayload.redirectTo.trim() : null,
src/app/api/domain/add/route.ts
Outdated
@@ -72,6 +145,7 @@ export async function POST(request: NextRequest) { | |||
{ status: 400 } | |||
); | |||
} | |||
console.error("error...", err) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The catch block prints 'err' even though the error variable is named 'error'. Rename 'err' to 'error' to correctly log the caught error.
console.error("error...", err) | |
console.error("error...", error) |
Copilot is powered by AI, so mistakes are possible. Review output carefully before use.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Copilot reviewed 9 out of 11 changed files in this pull request and generated 2 comments.
Files not reviewed (2)
- prisma/migrations/20250409071302_add_redirect_url/migration.sql: Language not supported
- prisma/schema.prisma: Language not supported
Co-authored-by: Copilot <[email protected]>
Co-authored-by: Copilot <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Copilot reviewed 9 out of 11 changed files in this pull request and generated 1 comment.
Files not reviewed (2)
- prisma/migrations/20250409071302_add_redirect_url/migration.sql: Language not supported
- prisma/schema.prisma: Language not supported
Comments suppressed due to low confidence (1)
src/components/proxies/add-proxy-dialog.tsx:46
- [nitpick] Using '0' as the port value for redirection might lead to unintended behavior if downstream logic does not expect a port of '0'. Please verify that this value is handled correctly or consider using an alternative indicator.
if (values.enableRedirection) { processedValues.destinationAddress = ''; processedValues.port = '0'; }
|
||
return issues.length === 0; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The superRefine callback in Zod is intended for adding custom issues and should not return a value. Remove the return statement to adhere to the expected callback signature.
return issues.length === 0; |
Copilot is powered by AI, so mistakes are possible. Review output carefully before use.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Copilot reviewed 9 out of 11 changed files in this pull request and generated 1 comment.
Files not reviewed (2)
- prisma/migrations/20250409071302_add_redirect_url/migration.sql: Language not supported
- prisma/schema.prisma: Language not supported
Comments suppressed due to low confidence (1)
src/lib/prisma.ts:11
- [nitpick] Consider removing the commented-out query logging code if it is no longer needed to improve code clarity.
// ? ["query", "error", "warn"]
if (data.enableRedirection && data.redirectTo) { | ||
if (!domainRegex.test(data.redirectTo.trim())) { | ||
ctx.addIssue({ | ||
path: ["redirectTo"], |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When redirection is enabled, the schema currently only refines the redirectTo field if a value is provided; consider enforcing a non-empty redirectTo when enableRedirection is true to avoid misconfiguration.
if (data.enableRedirection && data.redirectTo) { | |
if (!domainRegex.test(data.redirectTo.trim())) { | |
ctx.addIssue({ | |
path: ["redirectTo"], | |
if (data.enableRedirection) { | |
if (!data.redirectTo || data.redirectTo.trim() === "") { | |
ctx.addIssue({ | |
path: ["redirectTo"], | |
message: "redirectTo is required when enableRedirection is true", | |
code: z.ZodIssueCode.custom, | |
}); | |
issues.push("redirectTo"); | |
} else if (!domainRegex.test(data.redirectTo.trim())) { | |
ctx.addIssue({ | |
path: ["redirectTo"], |
Copilot is powered by AI, so mistakes are possible. Review output carefully before use.