Skip to content

Frontend: adapter to support bytes receiving for browsers different from Safari#87

Merged
iamandrii merged 2 commits into
mainfrom
m-86-file-bytes-fix
Jun 9, 2025
Merged

Frontend: adapter to support bytes receiving for browsers different from Safari#87
iamandrii merged 2 commits into
mainfrom
m-86-file-bytes-fix

Conversation

@iamandrii
Copy link
Copy Markdown
Contributor

Closes #86.

@iamandrii iamandrii requested a review from Copilot June 9, 2025 16:55

This comment was marked as outdated.

@iamandrii iamandrii requested a review from Copilot June 9, 2025 16:59
Copy link
Copy Markdown

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 adds a browser-compatible adapter for reading file bytes and updates the upload flow to use it, ensuring Safari and other browsers are both supported.

  • Introduce getFileBytes to handle file.bytes() (Safari/WebKit) and file.arrayBuffer() (Chrome/Firefox).
  • Update the existing upload call to use await getFileBytes(file) instead of await file.bytes().
Comments suppressed due to low confidence (2)

web/eclipse/src/pages/upload/Upload.tsx:14

  • There are no unit tests covering the new getFileBytes behavior for both Safari (file.bytes()) and Chrome/Firefox (file.arrayBuffer()) branches. Consider adding tests to verify each path.
async function getFileBytes(file: File): Promise<Uint8Array> {

web/eclipse/src/pages/upload/Upload.tsx:50

  • [nitpick] The variable name uplFilename is abbreviated and may be unclear; consider renaming it to uploadFilename for readability.
const uplFilename = (filename.trim() == "" ? file.name : filename).trim()

Comment thread web/eclipse/src/pages/upload/Upload.tsx
@iamandrii iamandrii merged commit d3ff91d into main Jun 9, 2025
3 checks passed
@iamandrii iamandrii deleted the m-86-file-bytes-fix branch June 9, 2025 17:04
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.

Frontend: lack of file.bytes() in Chromium

2 participants