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

[Bug]: File extension is missing on Windows #34450

Closed
3 tasks done
Sharcoux opened this issue Jun 6, 2022 · 3 comments · Fixed by #34723
Closed
3 tasks done

[Bug]: File extension is missing on Windows #34450

Sharcoux opened this issue Jun 6, 2022 · 3 comments · Fixed by #34723
Labels
19-x-y bug 🪲 has-repro-gist Issue can be reproduced with code at https://gist.github.com/ status/confirmed A maintainer reproduced the bug or agreed with the feature

Comments

@Sharcoux
Copy link

Sharcoux commented Jun 6, 2022

Preflight Checklist

Electron Version

18.1.0

What operating system are you using?

Windows

Operating System Version

Windows 10 - 10.0.19042

What arch are you using?

x64

Last Known Working Electron version

No response

Expected Behavior

When saving a file, the file type should be correctly defined and the filename should include the extension on the operating system so that the correct program is launch when double-clicking it

Actual Behavior

The extension is missing.

image

Here is the code we are using:

  const a = document.createElement('a')
  a.type = getMimeType(name)
  a.href = `data:${a.type || 'text/plain'};base64,${base64}`
  a.download = name
  a.click()

I'll try to add a fiddle later

Testcase Gist URL

https://gist.github.com/c07b1efe128ba059d0fad7ebeb7a94cb

Additional Information

This is reproducible only on Windows

@Sharcoux
Copy link
Author

Sharcoux commented Jun 6, 2022

This might be a duplicate that, maybe, should be reopened.

@deermichel
Copy link
Contributor

Hi @Sharcoux, thanks for reporting this and helping to make Electron better!

I was able to repro this on Electron 19, though an Electron Fiddle gist would be much appreciated, please follow up with one. As a workaround, including the file extension in the filename should work (or consider using the native save dialog as suggested in the issue you linked).

@deermichel deermichel added status/confirmed A maintainer reproduced the bug or agreed with the feature 19-x-y and removed status/confirmed A maintainer reproduced the bug or agreed with the feature labels Jun 7, 2022
@codebytere codebytere added the blocked/need-repro Needs a test case to reproduce the bug label Jun 7, 2022
@Sharcoux
Copy link
Author

Sharcoux commented Jun 8, 2022

Thanks for your investment. The issue is that, as the type is not specified, if the user want to rename the file, they will very likely lose the extension... So the workaround is not enough for our users, as they are not friendly with computer science ^^"

Here is the fiddle

@deermichel deermichel added status/confirmed A maintainer reproduced the bug or agreed with the feature has-repro-gist Issue can be reproduced with code at https://gist.github.com/ and removed blocked/need-repro Needs a test case to reproduce the bug labels Jun 9, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
19-x-y bug 🪲 has-repro-gist Issue can be reproduced with code at https://gist.github.com/ status/confirmed A maintainer reproduced the bug or agreed with the feature
Projects
No open projects
Status: Doesn't Block Stable
Development

Successfully merging a pull request may close this issue.

3 participants