leighmcculloch / AppSandboxFileAccess

A class that wraps up writing and accessing files outside a Mac apps App Sandbox files into a simple interface. The class will request permission from the user with a simple to understand dialog consistent with Apple's documentation and persist permissions across application runs.
BSD 2-Clause "Simplified" License
114 stars 23 forks source link

User can select 'wrong' folder #10

Open ConfusedVorlon opened 4 years ago

ConfusedVorlon commented 4 years ago

I just noticed this in my swift fork. If the user uses the recents dropdown in the file picker, then they can select a folder which is not the requested one. This causes an incorrect 'true' return in the requestPermission flow

My fix is to double-check on select

https://github.com/ConfusedVorlon/SwiftySandboxFileAccess/blob/2.0.0/SwiftySandboxFileAccess/Classes/SandboxFileAccessOpenSavePanelDelegate.swift

see: func panel(_ sender: Any, validate url: URL) throws

leighmcculloch commented 4 years ago

Nice catch, thanks for picking up on this!