Skip to content

Comments

Wrong format handling#55

Merged
Marek55S merged 5 commits intomainfrom
wrong_format_handling
Feb 15, 2026
Merged

Wrong format handling#55
Marek55S merged 5 commits intomainfrom
wrong_format_handling

Conversation

@Marek55S
Copy link

No description provided.

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR improves client-side handling of unsupported/invalid file formats during drag-and-drop uploads by surfacing react-dropzone rejection reasons to the user, and includes a Rust dependency lockfile update.

Changes:

  • Add file-rejection handling in ImageConverter to display specific rejection reasons.
  • Extend DragAndDropZone to optionally forward react-dropzone onDropRejected events via a new onFileReject prop.
  • Update api/Cargo.lock (notably glam patch version bump).

Reviewed changes

Copilot reviewed 2 out of 3 changed files in this pull request and generated 3 comments.

File Description
client/src/components/images/ImageConverter.tsx Adds handleFileReject and wires it into the drop zone to report rejected file reasons.
client/src/components/common/DragAndDropZone.tsx Adds an optional onFileReject prop and forwards onDropRejected callbacks from useDropzone.
api/Cargo.lock Updates locked Rust dependencies (including glam 0.30.9 → 0.30.10).

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@@ -1,9 +1,10 @@
import { useDropzone, type Accept } from 'react-dropzone';
import { FileRejection, useDropzone, type Accept } from 'react-dropzone';
Copy link

Copilot AI Feb 13, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

FileRejection is a type-only export from react-dropzone; importing it as a value can produce a runtime ESM import that fails if the bundler doesn’t elide type-only imports. Import it with import type { FileRejection } (and keep the useDropzone value import separate).

Suggested change
import { FileRejection, useDropzone, type Accept } from 'react-dropzone';
import { useDropzone, type Accept } from 'react-dropzone';
import type { FileRejection } from 'react-dropzone';

Copilot uses AI. Check for mistakes.
Comment on lines 69 to 70
if (onFileReject) {
onFileReject(rejectedFiles);
Copy link

Copilot AI Feb 13, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

onDropAccepted is wrapped in a try/catch, but onDropRejected isn’t. If onFileReject throws (e.g., state update logic changes later), it will become an uncaught exception from the dropzone handler. Wrap the onFileReject call in the same error handling used for accepted files (and optionally log a consistent error message).

Suggested change
if (onFileReject) {
onFileReject(rejectedFiles);
if (!onFileReject) {
return;
}
try {
onFileReject(rejectedFiles);
} catch (error) {
console.error('Error handling rejected files:', error);

Copilot uses AI. Check for mistakes.
@Marek55S Marek55S marked this pull request as draft February 13, 2026 17:12
@Marek55S Marek55S marked this pull request as ready for review February 15, 2026 13:44
@Marek55S Marek55S requested a review from Copilot February 15, 2026 13:44
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 2 out of 3 changed files in this pull request and generated no new comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@Marek55S Marek55S merged commit d8594be into main Feb 15, 2026
12 checks passed
@Marek55S Marek55S deleted the wrong_format_handling branch February 15, 2026 16:34
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