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

On macOS impossible to open file with comma followed by a space #890

Closed
1 task
friebetill opened this issue Nov 22, 2021 · 3 comments · Fixed by #897
Closed
1 task

On macOS impossible to open file with comma followed by a space #890

friebetill opened this issue Nov 22, 2021 · 3 comments · Fixed by #897
Assignees
Labels
desktop The issue applies to Windows, Linux or MacOS implementations. new issue An issue that hasn't yet been seen from the maintainer

Comments

@friebetill
Copy link

friebetill commented Nov 22, 2021

Describe the bug
Files with a comma followed by a space, e.g. "test, test.csv", cannot be opened correctly in the macOS version. The result consists of two non-existing files, even though only one file was selected.

Platform

  • Desktop (Go)

Platform OS version
macOS Big Sur 11.5.2

How are you picking?

  final result = await FilePicker.platform.pickFiles();
@friebetill friebetill added the new issue An issue that hasn't yet been seen from the maintainer label Nov 22, 2021
@philenius philenius self-assigned this Nov 22, 2021
@philenius philenius added the desktop The issue applies to Windows, Linux or MacOS implementations. label Nov 22, 2021
@philenius
Copy link
Collaborator

@miguelpruivo I'd need a programming advice:

macOS returns the list of picked files as a string where each file is prefixed with alias . Multiple files are separated by comma:

alias macOS:Users:John:Desktop:bill.pdf, alias macOS:Users:John:Desktop:holidays.png

My current implementation splits the string by , (comma followed by blank). Now, @friebetill gave an example where users name their files bla, .pdf. Obviously, it was a bad idea to split the macOS string by , .

I could change the implementation to split by , alias . This would enable users to pick files named bla, .pdf. But, it couldn't handle the situation where user name files like bla, alias .pdf.

No matter which separator I use to split the string returned by macOS, there will be some file names that won't work. Do you have a better idea than splitting by , alias ?

@miguelpruivo
Copy link
Owner

@philenius I’d split it by , alias macOS: just to make sure. It’s highly unlikely that users will have files with that name.

Since we’re working with strings I’m afraid there isn’t much to do.

philenius added a commit that referenced this issue Nov 28, 2021
Change the pattern from ", " to ", alias " when splitting the output
of osascript. Although this is not a perfect solution, it allows to pick
filenames that contain a comma followed by a blank (", ").
@philenius
Copy link
Collaborator

@miguelpruivo thanks for your quick response, then I'll do it that way.

Just for clarification: my example was slightly misleading. Actually, the first part that comes after alias represents the name of the volume on the macOS file system. It can be any value, e.g. macOS, macOS Base System, My USB, WD My Passport, etc.
So, I cannot split by , alias macOS: because the macOS part represents the volume's name. A better example would have been:

alias macOS:Users:John:Desktop:bill.pdf, alias macOS Base System:bin:bash, alias MyUSB:presentation.pptx

miguelpruivo pushed a commit that referenced this issue Nov 28, 2021
…ith-comma-followed-by-blank

#890: cannot pick filenames with comma followed by blank
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
desktop The issue applies to Windows, Linux or MacOS implementations. new issue An issue that hasn't yet been seen from the maintainer
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants