-
Notifications
You must be signed in to change notification settings - Fork 2
_⚠️ Potential issue_ #15
Copy link
Copy link
Open
Description
Image-count limit still bypassable
Users can select >3 files in one dialog. Cap total previews to 3:
-for (let i = 0; i < files.length; i++) {
+for (let i = 0; i < files.length && this.imagePreviews.length < 3; i++) {Optionally show a toast when the limit is reached.
Minor: type the event properly to avoid any:
onFileSelected(event: Event): void {
const input = event.target as HTMLInputElement;
const files = input.files!;
...
}🤖 Prompt for AI Agents
In src/app/features/add-new-post/add-new-post.component.ts around lines 235 to
277, the current code allows users to select more than 3 image files, bypassing
the intended limit. To fix this, add a check to cap the total number of image
previews to 3 by limiting the loop or skipping files beyond the third. Also,
replace the event parameter type from 'any' to 'Event' and cast event.target to
HTMLInputElement to properly type the files variable. Optionally, add a toast
notification when the limit is reached to inform users.
Originally posted by @coderabbitai[bot] in #14 (comment)
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels