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

Selected file is empty if filename contains a space #1231

Closed
falkoschindler opened this issue Oct 5, 2023 · 1 comment
Closed

Selected file is empty if filename contains a space #1231

falkoschindler opened this issue Oct 5, 2023 · 1 comment

Comments

@falkoschindler
Copy link

Specification

  • pywebview version: 4.0.2
  • operating system: Mac OS 13.4.1
  • web renderer: WebKit

Description

We noticed that our file picker yields empty files if we run with pywebview and the file contains a space.
The problem seems to be on the client side before the upload actually happens.
We boiled it down to this minimal example:

import webview

webview.create_window('Test', html='''
    <input type="file" onchange="displayFileSize()" />
    <script>
    function displayFileSize() {
        document.write(document.querySelector("input").files[0].size + " bytes");
    }
    </script>
''')
webview.start()

When picking a non-empty file like "test file.txt", the displayed size is 0.
When picking a non-empty file like "test_file.txt", the displayed size is not 0.

@r0x0r
Copy link
Owner

r0x0r commented Oct 6, 2023

Spaces in filenames were incorrectly encoded with %20s. I have fixed this in master now.

@r0x0r r0x0r closed this as completed Oct 6, 2023
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

No branches or pull requests

2 participants