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: prevent bundles from being selected in <input file="type"> open file dialog (macOS) #13220

Merged
merged 1 commit into from Jun 15, 2018

Conversation

Projects
None yet
4 participants
@miniak
Contributor

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 electron/reviewers as a code owner Jun 11, 2018

@MarshallOfSound

This comment has been minimized.

Member

MarshallOfSound commented Jun 12, 2018

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

This comment has been minimized.

Contributor

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

This comment has been minimized.

Member

MarshallOfSound commented Jun 12, 2018

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

This comment has been minimized.

Member

MarshallOfSound commented Jun 12, 2018

Related #8948

@miniak

This comment has been minimized.

Contributor

miniak commented Jun 12, 2018

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

@miniak miniak requested a review from zcbenz Jun 12, 2018

@miniak miniak changed the title from Add FILE_DIALOG_TREAT_PACKAGE_APP_AS_DIRECTORY to web open file dialog to Prevent bundles from being selected in <input file="type"> open file dialog (macOS) Jun 12, 2018

@codebytere codebytere changed the title from Prevent bundles from being selected in <input file="type"> open file dialog (macOS) to src: prevent bundles from being selected in <input file="type"> open file dialog (macOS) Jun 13, 2018

@codebytere

This comment has been minimized.

Member

codebytere commented Jun 13, 2018

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

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

@miniak

This comment has been minimized.

Contributor

miniak commented Jun 13, 2018

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

@miniak miniak requested review from ckerr and codebytere Jun 14, 2018

@ckerr ckerr merged commit c4942d9 into master Jun 15, 2018

11 checks passed

WIP ready for review
Details
ci/circleci: electron-linux-arm Your tests passed on CircleCI!
Details
ci/circleci: electron-linux-arm-test Your tests passed on CircleCI!
Details
ci/circleci: electron-linux-arm64 Your tests passed on CircleCI!
Details
ci/circleci: electron-linux-arm64-test Your tests passed on CircleCI!
Details
ci/circleci: electron-linux-ia32 Your tests passed on CircleCI!
Details
ci/circleci: electron-linux-x64 Your tests passed on CircleCI!
Details
ci/circleci: electron-mas-x64 Your tests passed on CircleCI!
Details
ci/circleci: electron-osx-x64 Your tests passed on CircleCI!
Details
continuous-integration/appveyor/branch AppVeyor build succeeded
Details
continuous-integration/appveyor/pr AppVeyor build succeeded
Details

@ckerr ckerr deleted the miniak/open-dialog-fix branch Jun 15, 2018

miniak added a commit that referenced this pull request Jun 18, 2018

miniak added a commit that referenced this pull request Jun 18, 2018

ckerr added a commit that referenced this pull request Jun 18, 2018

ckerr added a commit that referenced this pull request Jun 18, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment