Revert "Make the file manager work a little more sanely with regard to paths."

This breaks things even more on Windows :-(

This reverts commit 35243b9869.
pull/3/head
Dave Page 2016-06-17 18:19:51 +01:00
parent 35243b9869
commit 2c62d1a4b7
4 changed files with 22 additions and 7 deletions

View File

@ -245,6 +245,9 @@ 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):
"""

View File

@ -138,7 +138,9 @@ 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);
@ -249,7 +251,9 @@ 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);
@ -360,7 +364,9 @@ 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);
@ -469,7 +475,9 @@ 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');
});
@ -509,7 +517,9 @@ 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;

View File

@ -1120,6 +1120,8 @@ 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(

View File

@ -18,7 +18,7 @@ import config
def get_storage_directory():
if config.SERVER_MODE is not True:
return '/'
return None
storage_dir = getattr(
config, 'STORAGE_DIR',
@ -30,7 +30,7 @@ def get_storage_directory():
)
if storage_dir is None:
return '/'
return None
username = current_user.email.split('@')[0]
if len(username) == 0 or username[0].isdigit():