-
-
Notifications
You must be signed in to change notification settings - Fork 57
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
fix: duplicate validation #1097
Conversation
WalkthroughThis update introduces a new validation function, Changes
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (invoked as PR comments)
Additionally, you can add CodeRabbit Configration File (
|
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.
Actionable comments posted: 0
Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Files selected for processing (2)
- apps/server/src/api-data/db/db.router.ts (2 hunks)
- apps/server/src/api-data/db/db.validation.ts (1 hunks)
Additional comments not posted (3)
apps/server/src/api-data/db/db.router.ts (2)
21-21
: Update import to reflect the new validator function.The import statement has been correctly updated to include
validateNewFilenameBody
fromdb.validation.js
, aligning with the PR's objective to fix the parameter validation issue.
35-35
: Correctly integrated new validation logic in the duplicate endpoint.The route for duplicating a project file now correctly uses
validateNewFilenameBody
for validating thenewFilename
parameter. This change is consistent with the PR's description and should ensure that the correct data is validated.apps/server/src/api-data/db/db.validation.ts (1)
44-66
: Comprehensive validation logic fornewFilename
.The newly introduced
validateNewFilenameBody
function includes checks for existence, string type, trimming, sanitization, non-emptiness, and ensuring a JSON extension. The use of custom sanitizers and detailed error messages enhances security and user feedback. This addition aligns with the PR's goal to fix the parameter validation issue effectively.
Fixes an issue where we were validating the wrong parameter in the duplicate endpoint
In short: we sent a
newFilename
property but expected the existence of afilename