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]: SaveDialog is not treating Package as File when setting defaultPath to a file that already exists #43664

Open
3 tasks done
seismicsix opened this issue Sep 10, 2024 · 2 comments
Labels
32-x-y bug 🪲 has-repro-gist Issue can be reproduced with code at https://gist.github.com/ platform/macOS

Comments

@seismicsix
Copy link

Preflight Checklist

Electron Version

32.0.0

What operating system(s) are you using?

macOS

Operating System Version

macOS Sonoma 14.6.1

What arch are you using?

arm64 (including Apple Silicon)

Last Known Working Electron version

No response

Expected Behavior

When using the saveDialog, if the path is set to an existing file (package) the the file should not be selectable and the "file already Existing" warning should appear instead.

Actual Behavior

To test this - you can point the saveDialog defaultPath to any existing package file (i.e. xcodeproj)

dialog.showSaveDialog({ defaultPath: YOUR_PATH_TO_EXISTING_PACKAGE_FILE.xcodeproj, properties: [], filters: { name: 'directories', extensions: [] }, // to prevent file selection properties: ['showOverwriteConfirmation'] })

You see that the dialog then selects the package (as if it was a directory) and shows its content.

Also if the extension is removed, then it also does not detect it as a duplicate file.

Any info or guidance to how to resolve is appreciated.

Testcase Gist URL

No response

Additional Information

No response

@codebytere codebytere added the blocked/need-repro Needs a test case to reproduce the bug label Sep 10, 2024
@electron-issue-triage
Copy link

Hello @seismicsix. Thanks for reporting this and helping to make Electron better!

Would it be possible for you to make a standalone testcase with only the code necessary to reproduce the issue? For example, Electron Fiddle is a great tool for making small test cases and makes it easy to publish your test case to a gist that Electron maintainers can use.

Stand-alone test cases make fixing issues go more smoothly: it ensure everyone's looking at the same issue, it removes all unnecessary variables from the equation, and it can also provide the basis for automated regression tests.

Now adding the blocked/need-repro Needs a test case to reproduce the bug label for this reason. After you make a test case, please link to it in a followup comment. This issue will be closed in 10 days if the above is not addressed.

@seismicsix
Copy link
Author

https://gist.github.com/0db6d72cb9b4e15069c0e0ecd43799a3

Here is a gist to demo the issue...

If you add an xcode demo file (or any other package document type) in your documents folder /demo/demo.xcodeproj

Then run the saveDialog command and have it reference the same file - its will load it as a document and show its contents instead.

@electron-issue-triage electron-issue-triage bot removed the blocked/need-repro Needs a test case to reproduce the bug label Sep 10, 2024
@mlaurencin mlaurencin added the has-repro-gist Issue can be reproduced with code at https://gist.github.com/ label Oct 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
32-x-y bug 🪲 has-repro-gist Issue can be reproduced with code at https://gist.github.com/ platform/macOS
Projects
No open projects
Status: 👍 Does Not Block Stable
Development

No branches or pull requests

3 participants