Fix file browser path issue which occurs when client is on Windows and server is on Mac/Linux. Fixes #4164

This commit is contained in:
Aditya Toshniwal 2019-05-03 11:58:06 +05:30 committed by Akshay Joshi
parent f02f91cbf1
commit 036bd66638
4 changed files with 10 additions and 6 deletions

View File

@ -14,5 +14,6 @@ Features
Bug fixes
*********
| `Bug #4164 <https://redmine.postgresql.org/issues/4164>`_ - Fix file browser path issue which occurs when client is on Windows and server is on Mac/Linux.
| `Bug #4218 <https://redmine.postgresql.org/issues/4218>`_ - Properly assign dropdownParent in Select2 controls.
| `Bug #4219 <https://redmine.postgresql.org/issues/4219>`_ - Ensure popper.js is installed when needed.

View File

@ -157,7 +157,7 @@ module.exports = Alertify.dialog('createModeDlg', function() {
extension isn't *, then we add the extension.
*/
if (navigator.platform.toUpperCase().indexOf('WIN')!==-1) {
if ($('.file_manager').attr('data-platform') === 'win32') {
sep = '\\';
}

View File

@ -1193,6 +1193,8 @@ define([
Item Actions - Object events
---------------------------------------------------------*/
$('.file_manager').attr('data-platform', config.options.platform_type);
// Switch to folder view
$('.file_manager .fileinfo').on('click', function() {
$('.file_manager #uploader .input-path').val($('.currentpath').val());
@ -1388,7 +1390,7 @@ define([
path = '/';
}
if (navigator.platform.toUpperCase().indexOf('WIN')!==-1) {
if (config.options.platform_type === 'win32') {
path = path.replace(/\//g, '\\');
} else {
path = path.replace(/\\/g, '/');
@ -1533,20 +1535,20 @@ define([
$('.storage_dialog #uploader').find('a').remove();
$('.storage_dialog #uploader').find('b').remove();
if (navigator.platform.toUpperCase().indexOf('WIN')!==-1) {
if (config.options.platform_type === 'win32') {
path = path.replace(/\//g, '\\');
} else {
path = path.replace(/\\/g, '/');
}
path = decodeURI(path);
if (navigator.platform.toUpperCase().indexOf('WIN')!==-1) {
if (config.options.platform_type === 'win32') {
if (config.options.show_volumes && path == '\\') {
$('.storage_dialog #uploader .input-path').val('');
} else {
$('.storage_dialog #uploader .input-path').val(path);
}
} else if (!(navigator.platform.toUpperCase().indexOf('WIN')!==-1) &&
} else if (!(config.options.platform_type === 'win32') &&
(path == '' || !S.startsWith(path, '/'))) {
path = '/' + path;
$('.storage_dialog #uploader .input-path').val(path);
@ -1706,7 +1708,7 @@ define([
// helpful in show/hide toolbar button for Windows
hideButtons: function() {
return (
navigator.platform.toUpperCase().indexOf('WIN')!==-1 &&
this.config.options.platform_type === 'win32' &&
$('.currentpath').val() === ''
);
},

View File

@ -10,6 +10,7 @@
"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": {