Skip to content

Commit c5ef962

Browse files
committed
Fix nwjs#2961: nwdirectory
1 parent 37585d5 commit c5ef962

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

src/browser/file_select_helper.cc

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,8 @@ void FileSelectHelper::FileSelectedWithExtraInfo(
131131
}
132132

133133
const base::FilePath& path = file.local_path;
134-
if (dialog_type_ == ui::SelectFileDialog::SELECT_UPLOAD_FOLDER) {
134+
if (dialog_type_ == ui::SelectFileDialog::SELECT_UPLOAD_FOLDER &&
135+
extract_directory_) {
135136
StartNewEnumeration(path, kFileSelectEnumerationId, render_view_host_);
136137
return;
137138
}
@@ -359,6 +360,7 @@ void FileSelectHelper::RunFileChooser(content::WebContents* tab,
359360
// FileSelectHelper will keep itself alive until it sends the result message.
360361
scoped_refptr<FileSelectHelper> file_select_helper(
361362
new FileSelectHelper());
363+
file_select_helper->extract_directory_ = params.extract_directory;
362364
file_select_helper->RunFileChooser(tab->GetRenderViewHost(), tab, params);
363365
}
364366

@@ -437,7 +439,7 @@ void FileSelectHelper::RunFileChooserOnUIThread(
437439
dialog_type_ = ui::SelectFileDialog::SELECT_OPEN_MULTI_FILE;
438440
break;
439441
case FileChooserParams::UploadFolder:
440-
dialog_type_ = ui::SelectFileDialog::SELECT_UPLOAD_FOLDER;
442+
dialog_type_ = ui::SelectFileDialog::SELECT_FOLDER;
441443
break;
442444
case FileChooserParams::Save:
443445
dialog_type_ = ui::SelectFileDialog::SELECT_SAVEAS_FILE;

src/browser/file_select_helper.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -196,6 +196,8 @@ class FileSelectHelper
196196
// these files when they are no longer needed.
197197
std::vector<base::FilePath> temporary_files_;
198198

199+
bool extract_directory_;
200+
199201
DISALLOW_COPY_AND_ASSIGN(FileSelectHelper);
200202
};
201203

0 commit comments

Comments
 (0)