fluttercommunity / fluttercommunity/flutter_downloader

pdf files downloading as "inline"

Open
#272 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Kotlin
Stars
940
Forks
561
Avg merge
1h 18m
Merged PRs (30d)
1

Description

Hi,
Why the download of pdf files are always generated as "inline", even forcing a fileName.
Follows my implementation:

```
Future launchFileDownload(String url, String directory) async {
try {
String fileName;
final List splitedUrl = url?.split('/') ?? [];

// force name from url
// url example: "http://192.168.0.10:3000/files/presentation.pdf?token=fakeToken123456";
if (splitedUrl.isNotEmpty) {
String fileName = splitedUrl[splitedUrl.length - 1];
fileName = fileName?.split('?')[0]; // result: "presentation.pdf"
}

if (await Permission.storage.request().isGranted) {
return await FlutterDownloader.enqueue(
url: url,
fileName: fileName,
savedDir: directory,
showNotification: true,
openFileFromNotification: true,
);
}
} catch (error) {
print(error);
}
}
```

Terminal:
```
D/skia (10074): --- Failed to create image decoder with message 'unimplemented'
D/DownloadWorker(10074): Open connection to http://192.168.0.10:3000/files/presentation.pdf?token=fakeToken123456
D/DownloadWorker(10074): Content-Type = application/pdf
D/DownloadWorker(10074): Content-Length = 13264
D/DownloadWorker(10074): Charset = null
D/DownloadWorker(10074): Content-Disposition = inline
D/DownloadWorker(10074): fileName = inline
D/skia (10074): --- Failed to create image decoder with message 'unimplemented'
I/chatty (10074): uid=10138(com.myapp.apptest) pool-6-thread-1 identical 2 lines
D/skia (10074): --- Failed to create image decoder with message 'unimplemented'
D/DownloadWorker(10074): Setting an intent to open the file /storage/emulated/0/Android/data/com.myapp.apptest/files/inline
D/skia (10074): --- Failed to create image decoder with message 'unimplemented'
D/DownloadWorker(10074): File downloaded
I/WM-WorkerWrapper(10074): Worker result SUCCESS for Work [ id=99e16473-d04d-45c7-9891-7b279a8235e9, tags={ flutter_download_task, vn.hunghd.flutterdownloader.DownloadWorker } ]
```

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.