fix(webui): Add absolute path validation to compression paths input (fixes #1702).#1705
Conversation
WalkthroughAdded multiline absolute-path validation for compression jobs: a new validator checks each non-empty input line is an absolute path; the form item enforces this with a required/validator rule and updated placeholder; the compression schema now requires an array of absolute paths (minItems: 1). Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes
Pre-merge checks and finishing touches✅ Passed checks (3 passed)
✨ Finishing touches
🧪 Generate unit tests (beta)
📜 Recent review detailsConfiguration used: CodeRabbit UI Review profile: ASSERTIVE Plan: Pro 📒 Files selected for processing (1)
🧰 Additional context used📓 Path-based instructions (1)**/*.{cpp,hpp,java,js,jsx,tpp,ts,tsx}⚙️ CodeRabbit configuration file
Files:
🧠 Learnings (2)📓 Common learnings📚 Learning: 2024-11-15T16:22:33.635ZApplied to files:
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (5)
🔇 Additional comments (4)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
| // The `validator` function expects a `Promise` to be returned. | ||
| // eslint-disable-next-line @typescript-eslint/require-await | ||
| validator: async (_, value?: string) => { | ||
| const error = validateAbsolutePaths(value ?? ""); |
There was a problem hiding this comment.
I think they want you to use promises. Maybe look at the example here https://ant.design/components/form#form-demo-register.
There was a problem hiding this comment.
if i'm not wrong, the async syntax is also returning promises and cleaner to write / read. in fact, the async syntax enforces only Promises can be returned
similarly, if anything is thrown in the async function, promise rejections are automatically created
| label={"Paths"} | ||
| name={"paths"} | ||
| rules={[{required: true, message: "Please enter at least one path"}]} | ||
| rules={[ |
There was a problem hiding this comment.
then we might not need the check at the end as well. Since it would be redundant
There was a problem hiding this comment.
good point. let me try
There was a problem hiding this comment.
not sure how, but it seems once a validator is defined, any other fields in the rule are ignored
There was a problem hiding this comment.
actually let me try another approach
There was a problem hiding this comment.
splitting the rules works, but the whitespace thing we actually need to set it to true to prohibit whitespaces lol (like i thought setting whitespace: false would be more intuitive
anyways it's all good for review now
davemarco
left a comment
There was a problem hiding this comment.
mostly lgtm, do u want to move ur validator to my new validate.ts file after you merge main? then i will approve
# Conflicts: # components/webui/common/src/schemas/compression.ts


Description
This change introduces validation for absolute file system paths in compression job
submission workflows.
Changes include:
AbsolutePathSchemato constrain values to non-empty strings beginning with/.CompressionJobCreationSchemasopathsis now an array ofAbsolutePathSchemawithminItems: 1.validateAbsolutePathsto the ingest page to validate each line of multiline input.messages.
These updates ensure that only valid absolute paths can be submitted, preventing backend errors and
improving user feedback.
Checklist
breaking change.
Validation performed
/var/log/syslog/home/sampleslogs/syslog)~/samples)Summary by CodeRabbit
Bug Fixes
New Features
✏️ Tip: You can customize this high-level summary in your review settings.