Append the file suffix to filenames when needed in the File Create dialogue. Fixes #4069

This commit is contained in:
Dave Page 2019-03-14 15:48:21 +00:00
parent 145ca618ae
commit c548eac5ef
4 changed files with 28 additions and 8 deletions

View File

@ -24,5 +24,6 @@ Bug fixes
| `Bug #4053 <https://redmine.postgresql.org/issues/4053>`_ - Enable the online help button on the index dialogue.
| `Bug #4054 <https://redmine.postgresql.org/issues/4054>`_ - Handle resultsets with zero columns correctly in the Query Tool.
| `Bug #4060 <https://redmine.postgresql.org/issues/4060>`_ - Fix the latexpdf doc build.
| `Bug #4069 <https://redmine.postgresql.org/issues/4069>`_ - Append the file suffix to filenames when needed in the File Create dialogue.
| `Bug #4071 <https://redmine.postgresql.org/issues/4071>`_ - Ensure that Firefox prompts for a filename/location when downloading query results as a CSV file.
| `Bug #4073 <https://redmine.postgresql.org/issues/4073>`_ - Change the CodeMirror active line background colour to $color-danger-lighter so it doesn't conflict with the selection colour.

View File

@ -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;

View File

@ -1358,7 +1358,7 @@ define([
$('.file_manager button.delete, .file_manager button.download, .file_manager button.rename').removeAttr(
'disabled'
);
// set selected folder name in breadcrums
// set selected folder name in breadcrumbs
$('.file_manager #uploader .show_selected_file').remove();
}
@ -1388,7 +1388,7 @@ define([
path = '/';
}
if (config.options.platform_type === 'win32') {
if (navigator.platform.toUpperCase().indexOf('WIN')!==-1) {
path = path.replace(/\//g, '\\');
} else {
path = path.replace(/\\/g, '/');
@ -1533,20 +1533,20 @@ define([
$('.storage_dialog #uploader').find('a').remove();
$('.storage_dialog #uploader').find('b').remove();
if (config.options.platform_type === 'win32') {
if (navigator.platform.toUpperCase().indexOf('WIN')!==-1) {
path = path.replace(/\//g, '\\');
} else {
path = path.replace(/\\/g, '/');
}
path = decodeURI(path);
if (config.options.platform_type === 'win32') {
if (navigator.platform.toUpperCase().indexOf('WIN')!==-1) {
if (config.options.show_volumes && path == '\\') {
$('.storage_dialog #uploader .input-path').val('');
} else {
$('.storage_dialog #uploader .input-path').val(path);
}
} else if (!config.options.platform_type === 'win32' &&
} else if (!(navigator.platform.toUpperCase().indexOf('WIN')!==-1) &&
(path == '' || !S.startsWith(path, '/'))) {
path = '/' + path;
$('.storage_dialog #uploader .input-path').val(path);
@ -1706,7 +1706,7 @@ define([
// helpful in show/hide toolbar button for Windows
hideButtons: function() {
return (
this.config.options.platform_type == 'win32' &&
navigator.platform.toUpperCase().indexOf('WIN')!==-1 &&
$('.currentpath').val() === ''
);
},

View File

@ -10,7 +10,6 @@
"fileRoot": "{{data.fileroot}}",
"capabilities": [{% for i in data.capabilities %}{% if loop.index != 1 %}, {% endif %}"{{i}}"{% endfor %}],
"allowed_file_types": [{% for i in data.supported_types %}{% if loop.index != 1 %}, {% endif %}"{{i}}"{% endfor %}],
"platform_type": "{{ data.platform_type }}",
"show_volumes": {% if data.show_volumes %}true{% else %}false{% endif %}
},
"security": {