From 74e71ca96a38432cf4b15fb870e2cb1d98fd4e2a Mon Sep 17 00:00:00 2001 From: afer <791143125@qq.com> Date: Wed, 4 Dec 2024 17:37:42 +0800 Subject: [PATCH] Update file_service_compat.dart --- .../lib/src/compat/file_service_compat.dart | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/flutter_cache_manager/lib/src/compat/file_service_compat.dart b/flutter_cache_manager/lib/src/compat/file_service_compat.dart index bbd7a6ff..0df201e1 100644 --- a/flutter_cache_manager/lib/src/compat/file_service_compat.dart +++ b/flutter_cache_manager/lib/src/compat/file_service_compat.dart @@ -63,15 +63,13 @@ class CompatFileServiceGetResponse implements FileServiceResponse { @override String get fileExtension { - // var fileExtension = ''; - // final contentTypeHeader = _header(HttpHeaders.contentTypeHeader); - // if (contentTypeHeader != null) { - // final contentType = ContentType.parse(contentTypeHeader); - // fileExtension = contentType.fileExtension; - // } - // return fileExtension; - - return '.jpeg'; + var fileExtension = ''; + final contentTypeHeader = _header(HttpHeaders.contentTypeHeader); + if (contentTypeHeader != null) { + final contentType = ContentType.parse(contentTypeHeader); + fileExtension = contentType.fileExtension; + } + return fileExtension; } @override