hpoul / file_picker_writable

Flutter plugin to choose files which can be read, referenced and written back at a later time.
https://pub.dev/packages/file_picker_writable
MIT License
17 stars 13 forks source link

Files opened by "Copy to" on iOS are not re-openable #3

Closed amake closed 4 years ago

amake commented 4 years ago

On iOS, files can be opened from other apps in two ways:

Previously, I thought that with correct setup (proper keys in Info.plist), all apps would be able to "Open In", but it turns out that some, in particular Google Drive, can never "Open In" but only offer "Copy To", regardless of the target application and its capabilities.

file_picker_writable currently handles receiving "Copy To" files OK: it ignores the failure to obtain a security scope in _prepareUrlForReading: https://github.com/hpoul/file_picker_writable/blob/72470d06f366039c568cd216fb5ccc6608cb9326/ios/Classes/SwiftFilePickerWritablePlugin.swift#L188-L198

But when trying to reopen a bookmark obtained from such a file, it fails due to strict checking in readFile: https://github.com/hpoul/file_picker_writable/blob/72470d06f366039c568cd216fb5ccc6608cb9326/ios/Classes/SwiftFilePickerWritablePlugin.swift#L104-L106

amake commented 4 years ago

Now this PR fixes #4 as well.

amake commented 4 years ago

Thanks for merging. But somehow I don't see it in the master branch.

hpoul commented 4 years ago

oops sorry.. no idea how that happened.. i think i've did one force push too many.. thanks for catching that 🤦️