Re: [w3ctag/design-reviews] Moving local files with the File System Access API (Issue #805)

> does the API allow for graceful fallback when the browser in question doesn't support file moves in the local file system

On browsers for which only the Bucket File System is supported, well, there is currently no way to get a `FileSystemHandle` corresponding to the local file system at all. But if a browser wanted to support the local file system in a limited capacity - say, by [allowing read-only access to files which are dragged-and-dropped or selected via a file picker](https://github.com/WebKit/standards-positions/issues/28#issuecomment-1422985182) - then [the requirement of "readwrite" permission to (at least) the source file](https://github.com/whatwg/fs/blob/main/proposals/MovingNonOpfsFiles.md#permission-checks) would result in the `move()` method reliably throwing a `NotAllowedError` exception

> Is that detectable? 

Were other browsers to implement (even partial) support for the local file system, that could include upstreaming  the [`FileSystemHandle.queryPermission()` method](https://wicg.github.io/file-system-access/#api-filesystemhandle-querypermission) (and possibly also the [`FileSystemHandle.requestPermission()` method](https://wicg.github.io/file-system-access/#api-filesystemhandle-requestpermission)) from the [WICG spec](https://wicg.github.io/file-system-access/) to the [whatwg spec](https://fs.spec.whatwg.org/). The website could then check `queryPermission({ mode : "readwrite" })` before bothering to try to `move()` the file

> Have you thought about how this would behave differently with isolated web apps https://github.com/w3ctag/design-reviews/issues/842 ?

The permission requirements mentioned above will also apply to IWAs. If the user agent wanted to somehow privilege IWAs - say, by allowing only IWAs to call `move()` - that would be facilitated by granting the appropriate File System permissions to  the IWA. The means of handing out File System permissions for the local file system - to IWAs or otherwise - will presumably remain implementation-defined

-- 
Reply to this email directly or view it on GitHub:
https://github.com/w3ctag/design-reviews/issues/805#issuecomment-1688602214
You are receiving this because you are subscribed to this thread.

Message ID: <w3ctag/design-reviews/issues/805/1688602214@github.com>

Received on Tuesday, 22 August 2023 17:11:10 UTC