Skip to content

fix: prevent bundles from being selected in <input file="type"> open file dialog (macOS)#13220

Merged
ckerr merged 1 commit intomasterfrom
miniak/open-dialog-fix
Jun 15, 2018
Merged

fix: prevent bundles from being selected in <input file="type"> open file dialog (macOS)#13220
ckerr merged 1 commit intomasterfrom
miniak/open-dialog-fix

Conversation

@miniak
Copy link
Copy Markdown
Contributor

@miniak miniak commented Jun 11, 2018

Fixes #13219

Another option is to use NSOpenSavePanelDelegate and don't allow bundles to be selected:

- (BOOL)panel:(id)sender shouldEnableURL:(NSURL *)url {
    NSString* itemUTI = nil;
    [url getResourceValue:&itemUTI forKey:NSURLTypeIdentifierKey error:nil];

    return UTTypeConformsTo((__bridge CFStringRef)itemUTI, kUTTypeData)
        || UTTypeConformsTo((__bridge CFStringRef)itemUTI, kUTTypeFolder);
}

@miniak miniak requested a review from a team June 11, 2018 20:05
@MarshallOfSound
Copy link
Copy Markdown
Member

I believe it is intended behavior for them to be selectable, for example in Chrome when you select a .app bundle you get a ZIP file transparently. Can we hook that up somehow?

@miniak
Copy link
Copy Markdown
Contributor Author

miniak commented Jun 12, 2018

@MarshallOfSound While that would be nice to have, I don’t have time to do it. Feel free to pick it up :) I suggest mitigating the current broken behavior for now.

@MarshallOfSound
Copy link
Copy Markdown
Member

I suggest mitigating the current broken behavior for now.

I'm 👍 on that, let's patch out the broken behavior and look into getting the optimum behavior later. Would like a second ✅ before merging.

@MarshallOfSound
Copy link
Copy Markdown
Member

Related #8948

@miniak
Copy link
Copy Markdown
Contributor Author

miniak commented Jun 12, 2018

Does it make sense to backport the fix to the release branches?

@miniak miniak requested a review from zcbenz June 12, 2018 15:53
@miniak miniak changed the title Add FILE_DIALOG_TREAT_PACKAGE_APP_AS_DIRECTORY to web open file dialog Prevent bundles from being selected in <input file="type"> open file dialog (macOS) Jun 12, 2018
@codebytere codebytere changed the title Prevent bundles from being selected in <input file="type"> open file dialog (macOS) src: prevent bundles from being selected in <input file="type"> open file dialog (macOS) Jun 13, 2018
@codebytere
Copy link
Copy Markdown
Member

codebytere commented Jun 13, 2018

hey @miniak would you mind starting to use semantic PR titles? thanks :)

@codebytere codebytere changed the title src: prevent bundles from being selected in <input file="type"> open file dialog (macOS) fix: prevent bundles from being selected in <input file="type"> open file dialog (macOS) Jun 13, 2018
@miniak
Copy link
Copy Markdown
Contributor Author

miniak commented Jun 13, 2018

@codebytere I will keep that in mind next time :)

@miniak miniak requested review from ckerr and codebytere June 14, 2018 19:14
@ckerr ckerr merged commit c4942d9 into master Jun 15, 2018
@ckerr ckerr deleted the miniak/open-dialog-fix branch June 15, 2018 20:51
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.

4 participants