From c274feca17f0f0345fef0475dc6cd8eb911d0ac0 Mon Sep 17 00:00:00 2001 From: Anthony Tseng Date: Wed, 21 Feb 2018 16:26:26 -0800 Subject: [PATCH] Obtain extension from path when no mime type available fix https://github.com/brave/browser-laptop/issues/13230 fix https://github.com/brave/browser-laptop/issues/13228 Auditors: @bridiver, @bsclifton --- atom/browser/atom_download_manager_delegate.cc | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/atom/browser/atom_download_manager_delegate.cc b/atom/browser/atom_download_manager_delegate.cc index 92c093f7d5..57ac9ad620 100644 --- a/atom/browser/atom_download_manager_delegate.cc +++ b/atom/browser/atom_download_manager_delegate.cc @@ -139,7 +139,12 @@ void AtomDownloadManagerDelegate::OnDownloadPathGenerated( if (path.empty()) { std::vector extensions; base::FilePath::StringType extension; - if (GetItemExtension(item, &extension)) { + if (!GetItemExtension(item, &extension)) { + extension = target_path.Extension(); + if (!extension.empty()) + extension.erase(extension.begin()); // Erase preceding '.'. + } + if (!extension.empty()) { extensions.push_back(extension); file_type_info.extensions.push_back(extensions); }