Description
On Android < 30, FileTransfer.downloadFile() appears to require public storage permission even when the destination is an app-private file:// path under the app data directory.
In our Capacitor app, downloading a ~21 MB SQLite metadata snapshot to an app-private path failed almost immediately on Android 9/10 with:
Error during file transfer
The same download succeeds when using deprecated Filesystem.downloadFile() with directory: Directory.Data, which only checks storage permission for public directories.
Reproduction shape
const path = `tmp/data.sqlite`
await Filesystem.mkdir({ path: `tmp`, directory: Directory.Data, recursive: true })
const { uri } = await Filesystem.getUri({ path, directory: Directory.Data })
// Fails quickly on Android < 30 due to storage permission path
await FileTransfer.downloadFile({ url, path: uri })
// Works; writes to app-private storage
await Filesystem.downloadFile({
url,
path,
directory: Directory.Data,
recursive: true,
})
Expected behavior
FileTransfer.downloadFile() should not require public/external storage permission when the destination is app-private storage, or it should provide an option/API shape equivalent to Filesystem.downloadFile({ directory: Directory.Data }).
Versions
@capacitor/core: ^8.3.1
@capacitor/file-transfer: ^2.0.4
@capacitor/filesystem: ^8.1.2
- Observed on Android 9/10; API 28 repro confirmed.
Description
On Android < 30,
FileTransfer.downloadFile()appears to require public storage permission even when the destination is an app-privatefile://path under the app data directory.In our Capacitor app, downloading a ~21 MB SQLite metadata snapshot to an app-private path failed almost immediately on Android 9/10 with:
The same download succeeds when using deprecated
Filesystem.downloadFile()withdirectory: Directory.Data, which only checks storage permission for public directories.Reproduction shape
Expected behavior
FileTransfer.downloadFile()should not require public/external storage permission when the destination is app-private storage, or it should provide an option/API shape equivalent toFilesystem.downloadFile({ directory: Directory.Data }).Versions
@capacitor/core:^8.3.1@capacitor/file-transfer:^2.0.4@capacitor/filesystem:^8.1.2