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

Fix incorrect extension when filters is used #9610

Conversation

shubham2892
Copy link
Contributor

Running [dialog setAllowedFileTypes:file_types]; replaces the extension in nameFieldStringValue with first value in file_types variable however if [dialog setNameFieldStringValue:default_filename]; is run after setting the allowedFileTypes the extension initially passed with the default filename is retained. Explicitly setting setExtensionHidden makes sure that extension is shown everytime.
Screenshots to confirm that issue is fixed:

Code:

   const {dialog} = require('electron')
   dialog.showSaveDialog(mainWindow, {
     defaultPath:'/tmp/test.jpg',
     filters: [
       { name: 'Image', extensions: ['jpg', 'jpeg', 'png', 'gif'] }
     ]
   }, function(filename) {})

Result:
image

#9455

@shubham2892 shubham2892 changed the title 🍎 Fix incorrect extension when filters is used Fix incorrect extension when filters is used May 28, 2017
@shubham2892
Copy link
Contributor Author

Not sure why this single test is failing on CI build, completely unrelated to changes I made. It's the same test that was failing in #9343 .

@shubham2892
Copy link
Contributor Author

@kevinsawicki: Please have a look at your convenience. Thank you. 😄

@kevinsawicki
Copy link
Contributor

Thanks for fixing this @shubham2892 👍 :shipit:

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

Successfully merging this pull request may close these issues.

None yet

2 participants