diff --git a/lib/domain/profiles/profile.dart b/lib/domain/profiles/profile.dart index 0f265a11..631dc81b 100644 --- a/lib/domain/profiles/profile.dart +++ b/lib/domain/profiles/profile.dart @@ -42,6 +42,18 @@ class Profile with _$Profile { title = titleHeader; } } + + if (title.isEmpty) { + final contentDisposition = headers['content-disposition']?.single; + if (contentDisposition != null) { + final RegExp regExp = RegExp(r'filename="([^"]*)"'); + final match = regExp.firstMatch(contentDisposition); + if (match != null && match.groupCount >= 1) { + title = match.group(1) ?? ''; + } + } + } + if (title.isEmpty) { final part = url.split("/").lastOrNull; if (part != null) {