diff --git a/docs/en_US/release_notes_4_4.rst b/docs/en_US/release_notes_4_4.rst index d9820652..4250d58e 100644 --- a/docs/en_US/release_notes_4_4.rst +++ b/docs/en_US/release_notes_4_4.rst @@ -23,5 +23,6 @@ Bug fixes | `Bug #4053 `_ - Enable the online help button on the index dialogue. | `Bug #4054 `_ - Handle resultsets with zero columns correctly in the Query Tool. | `Bug #4060 `_ - Fix the latexpdf doc build. +| `Bug #4069 `_ - Append the file suffix to filenames when needed in the File Create dialogue. | `Bug #4071 `_ - Ensure that Firefox prompts for a filename/location when downloading query results as a CSV file. | `Bug #4073 `_ - Change the CodeMirror active line background colour to $color-danger-lighter so it doesn't conflict with the selection colour. \ No newline at end of file diff --git a/web/pgadmin/misc/file_manager/static/js/create_dialogue.js b/web/pgadmin/misc/file_manager/static/js/create_dialogue.js index ec2a474e..33a3691a 100644 --- a/web/pgadmin/misc/file_manager/static/js/create_dialogue.js +++ b/web/pgadmin/misc/file_manager/static/js/create_dialogue.js @@ -146,7 +146,27 @@ module.exports = Alertify.dialog('createModeDlg', function() { file_data = { 'path': $('.currentpath').val(), }, - innerbody; + innerbody, + sep = '/', + ext = $('.allowed_file_types select').val(); + + /* + Add the file extension if necessary, and if the file type selector + isn't set to "All Files". If there's no . at all in the path, or + there is a . already but it's not following the last /, AND the + extension isn't *, then we add the extension. + */ + + if (navigator.platform.toUpperCase().indexOf('WIN')!==-1) { + sep = '\\'; + } + + if ((!newFile.includes('.') || + newFile.split('.').pop().includes(sep)) && + ext != '*') { + newFile = newFile + '.' + ext; + $('.storage_dialog #uploader .input-path').val(newFile); + } if (!this.check_permission(newFile)) { closeEvent.cancel = true;