Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Svelte v.5 passes a file as a string (rather than as a file) into a web component prop #14391

Open
nevil2 opened this issue Nov 21, 2024 · 1 comment
Labels
awaiting submitter needs a reproduction, or clarification

Comments

@nevil2
Copy link

nevil2 commented Nov 21, 2024

Describe the bug

With Svelte 5 pre-release (up to 23rd September), an image as a file could be passed into a web component as follows:

<webcomponent {image} />

With Svelte 5 stable (after installation on 5th November), the web component receives the image as a string "[object File]" rather than as a file.

Since there were no changes to the web component and the problem occurs on multiple browsers, the issue must relate to a change in Svelte 5. Web component also works with other frameworks such as React.

Reproduction

https://climbers-club.co.uk/climbing/submission?tab=Create%20Topo demonstrates the problem.

Inspect the console to see logging messages.

Drag a photo into the box.

The svelte component receives the image file and passes it to the web component.

The web component receives a string.

Logs

Svelte component loaded image with filename Hollowstones.jpg; instanceof File : true
Webcomponent receiving image: typeof string; value: [object File]

System Info

System:
    OS: Linux 5.15 Ubuntu 22.04.3 LTS 22.04.3 LTS (Jammy Jellyfish)
    CPU: (12) x64 AMD Ryzen 5 5600X 6-Core Processor
    Memory: 3.18 GB / 15.59 GB
    Container: Yes
    Shell: 5.1.16 - /bin/bash
  Binaries:
    Node: 20.10.0 - /tmp/fnm_multishells/6152_1732173769447/bin/node
    npm: 10.9.0 - /tmp/fnm_multishells/6152_1732173769447/bin/npm
  npmPackages:
    svelte: ^5.1.4 => 5.2.7

Severity

blocking all usage of svelte

@nevil2 nevil2 changed the title Svelte ^v.5.0.0 passes a file as a string (rather than as a file) into a web component prop Svelte v.5 passes a file as a string (rather than as a file) into a web component prop Nov 21, 2024
@dummdidumm
Copy link
Member

Please provide a minimum reproducible with access to the code, not a blackbox link to a full website

@dummdidumm dummdidumm added the awaiting submitter needs a reproduction, or clarification label Nov 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
awaiting submitter needs a reproduction, or clarification
Projects
None yet
Development

No branches or pull requests

2 participants