Skip to content
This repository has been archived by the owner on Jan 4, 2019. It is now read-only.

Obtain extension from path when no mime type available #503

Merged
merged 1 commit into from
Feb 22, 2018
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion atom/browser/atom_download_manager_delegate.cc
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,12 @@ void AtomDownloadManagerDelegate::OnDownloadPathGenerated(
if (path.empty()) {
std::vector<base::FilePath::StringType> extensions;
base::FilePath::StringType extension;
if (GetItemExtension(item, &extension)) {
if (!GetItemExtension(item, &extension)) {
extension = target_path.Extension();
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

wouldn't it make more sense to put this code in GetItemExtension?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah, good call. will do a follow up

if (!extension.empty())
extension.erase(extension.begin()); // Erase preceding '.'.
}
if (!extension.empty()) {
extensions.push_back(extension);
file_type_info.extensions.push_back(extensions);
}
Expand Down