From 617bff8ec85b4717316d0fe8e258868e4f9f6e05 Mon Sep 17 00:00:00 2001 From: Haojian Wu Date: Tue, 28 Jul 2015 10:30:36 +0800 Subject: [PATCH] Fix a missing the specified mime type check in accept attribute. --- atom/browser/web_dialog_helper.cc | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/atom/browser/web_dialog_helper.cc b/atom/browser/web_dialog_helper.cc index 93cb32cba7..a37d357d47 100644 --- a/atom/browser/web_dialog_helper.cc +++ b/atom/browser/web_dialog_helper.cc @@ -43,14 +43,15 @@ file_dialog::Filters GetFileTypesFromAcceptType( // Skip the first character. extensions.push_back(extension.substr(1)); } else { - if (ascii_type == "image/*" || ascii_type == "audio/*" || - ascii_type == "video/*") { - // For MIME Type - net::GetExtensionsForMimeType(ascii_type, &extensions); - } + // For MIME Type, `audio/*, vidio/*, image/* + net::GetExtensionsForMimeType(ascii_type, &extensions); } } + // If no valid exntesion is added, return empty filters. + if (extensions.empty()) + return filters; + filters.push_back(file_dialog::Filter()); for (const auto& extension : extensions) { #if defined(OS_WIN)