mirror of
https://github.com/pgadmin-org/pgadmin4.git
synced 2025-02-25 18:55:31 -06:00
Make the file manager work a little more sanely with regard to paths.
This commit is contained in:
parent
1172e31019
commit
35243b9869
@ -245,9 +245,6 @@ class Filemanager(object):
|
||||
)
|
||||
self.dir = get_storage_directory()
|
||||
|
||||
if self.dir is not None and isinstance(self.dir, list):
|
||||
self.dir = ""
|
||||
|
||||
@staticmethod
|
||||
def create_new_transaction(params):
|
||||
"""
|
||||
|
@ -138,9 +138,7 @@ define([
|
||||
sel_file = $('.fileinfo tbody tr.selected td p span').attr('title');
|
||||
}
|
||||
var newFile = $('.currentpath').val() + sel_file;
|
||||
if (newFile.indexOf('/') == 0) {
|
||||
newFile = newFile.substr(1);
|
||||
}
|
||||
|
||||
pgAdmin.Browser.Events.trigger('pgadmin-storage:finish_btn:storage_dialog', newFile);
|
||||
}
|
||||
removeTransId(trans_id);
|
||||
@ -251,9 +249,7 @@ define([
|
||||
sel_file = $('.fileinfo tbody tr.selected td p span').attr('title');
|
||||
}
|
||||
var newFile = $('.currentpath').val() + sel_file;
|
||||
if (newFile.indexOf('/') == 0) {
|
||||
newFile = newFile.substr(1);
|
||||
}
|
||||
|
||||
pgAdmin.Browser.Events.trigger('pgadmin-storage:finish_btn:select_file', newFile);
|
||||
}
|
||||
removeTransId(trans_id);
|
||||
@ -364,9 +360,7 @@ define([
|
||||
sel_file = $('.fileinfo tbody tr.selected td p span').attr('title');
|
||||
}
|
||||
var newFile = $('.currentpath').val() + sel_file;
|
||||
if (newFile.indexOf('/') == 0) {
|
||||
newFile = newFile.substr(1);
|
||||
}
|
||||
|
||||
pgAdmin.Browser.Events.trigger('pgadmin-storage:finish_btn:select_folder', newFile);
|
||||
}
|
||||
removeTransId(trans_id);
|
||||
@ -475,9 +469,7 @@ define([
|
||||
$('.replace_file, .fm_dimmer').hide();
|
||||
var selected_item = $('.allowed_file_types .create_input input[type="text"]').val(),
|
||||
newFile = $('.currentpath').val() + selected_item;
|
||||
if (newFile.indexOf('/') == 0) {
|
||||
newFile = newFile.substr(1);
|
||||
}
|
||||
|
||||
pgAdmin.Browser.Events.trigger('pgadmin-storage:finish_btn:create_file', newFile);
|
||||
$('.file_manager_create_cancel').trigger('click');
|
||||
});
|
||||
@ -517,9 +509,7 @@ define([
|
||||
if (closeEvent.button.text == "{{ _('Create') }}") {
|
||||
var selected_item = $('.allowed_file_types .create_input input[type="text"]').val();
|
||||
var newFile = $('.currentpath').val() + selected_item;
|
||||
if (newFile.indexOf('/') == 0) {
|
||||
newFile = newFile.substr(1);
|
||||
}
|
||||
|
||||
if(!_.isUndefined(selected_item) && selected_item !== '' && this.is_file_exist()) {
|
||||
this.replace_file();
|
||||
closeEvent.cancel = true;
|
||||
|
@ -1120,8 +1120,6 @@ def load_file():
|
||||
|
||||
# retrieve storage directory path
|
||||
storage_manager_path = get_storage_directory()
|
||||
if storage_manager_path is None:
|
||||
storage_manager_path = ""
|
||||
|
||||
# generate full path of file
|
||||
file_path = os.path.join(
|
||||
|
@ -18,7 +18,7 @@ import config
|
||||
def get_storage_directory():
|
||||
|
||||
if config.SERVER_MODE is not True:
|
||||
return None
|
||||
return '/'
|
||||
|
||||
storage_dir = getattr(
|
||||
config, 'STORAGE_DIR',
|
||||
@ -30,7 +30,7 @@ def get_storage_directory():
|
||||
)
|
||||
|
||||
if storage_dir is None:
|
||||
return None
|
||||
return '/'
|
||||
|
||||
username = current_user.email.split('@')[0]
|
||||
if len(username) == 0 or username[0].isdigit():
|
||||
|
Loading…
Reference in New Issue
Block a user