Skip to content

fix(react): validate filename and handle errors in AttachmentPreview submit - #1414

Open
yashsarvaiya45 wants to merge 1 commit into
RocketChat:developfrom
yashsarvaiya45:fix/attachment-preview-validation
Open

yashsarvaiya45 wants to merge 1 commit into
RocketChat:developfrom
yashsarvaiya45:fix/attachment-preview-validation

Conversation

@yashsarvaiya45

Copy link
Copy Markdown

Description

  • Added validation guards to prevent submitting attachments with empty or whitespace-only filenames (!fileName?.trim()).
  • Disabled the send button when the file name is blank to prevent accidental empty submissions from the UI.
  • Added a catch block around RCInstance.sendAttachment to properly catch and log network/server upload errors, preventing unhandled promise rejections.
  • Sanitized the attachment filename with .trim() prior to sending.

Testing

  • Verified local code formatting and lint checks pass cleanly (yarn lint).

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant