mirror of
https://github.com/lifegpc/eh_downloader_flutter.git
synced 2026-07-08 01:30:28 +08:00
Support download zip on web
This commit is contained in:
@@ -5,3 +5,22 @@ bool get isDesktop =>
|
||||
!kIsWeb && (Platform.isWindows || Platform.isLinux || Platform.isMacOS);
|
||||
bool get isWindows => !kIsWeb && Platform.isWindows;
|
||||
bool get isAndroid => !kIsWeb && Platform.isAndroid;
|
||||
|
||||
String? getFilenameFromContentDisposition(String? contentDisposition) {
|
||||
if (contentDisposition == null) {
|
||||
return null;
|
||||
}
|
||||
var ind = contentDisposition.indexOf("filename=\"");
|
||||
if (ind != -1) {
|
||||
final filename = contentDisposition.substring(
|
||||
ind + 10, contentDisposition.lastIndexOf("\""));
|
||||
return Uri.decodeComponent(filename);
|
||||
}
|
||||
ind = contentDisposition.indexOf("filename*=UTF-8''");
|
||||
if (ind != -1) {
|
||||
final filename =
|
||||
contentDisposition.substring(ind + 17, contentDisposition.length);
|
||||
return Uri.decodeComponent(filename);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user