additonal fix to windows path bug

This commit is contained in:
Andrew 2022-01-19 16:47:51 -05:00
parent e0b3ec4634
commit 4fe174d6d2
2 changed files with 14 additions and 28 deletions

View File

@ -258,8 +258,8 @@ class Controller:
if helper.is_os_windows():
server_dir = helper.wtol_path(server_dir)
backup_path = helper.wtol_path(backup_path)
server_dir.replace(' ', '^ ')
backup_path.replace(' ', '^ ')
server_dir.replace(' ', '` ')
backup_path.replace(' ', '` ')
server_file = "{server}-{version}.jar".format(server=server, version=version)
full_jar_path = os.path.join(server_dir, server_file)
@ -283,12 +283,8 @@ class Controller:
logger.error("Unable to create required server files due to :{}".format(e))
return False
if helper.is_os_windows():
server_command = 'java -Xms{}M -Xmx{}M -jar {} nogui'.format(helper.float_to_string(min_mem),
helper.float_to_string(max_mem),
'"'+full_jar_path+'"')
else:
server_command = 'java -Xms{}M -Xmx{}M -jar {} nogui'.format(helper.float_to_string(min_mem),
server_command = 'java -Xms{}M -Xmx{}M -jar {} nogui'.format(helper.float_to_string(min_mem),
helper.float_to_string(max_mem),
full_jar_path)
server_log_file = "{}/logs/latest.log".format(server_dir)
@ -324,8 +320,8 @@ class Controller:
if helper.is_os_windows():
server_dir = helper.wtol_path(new_server_dir)
backup_path = helper.wtol_path(backup_path)
new_server_dir.replace(' ', '^ ')
backup_path.replace(' ', '^ ')
new_server_dir.replace(' ', '` ')
backup_path.replace(' ', '` ')
helper.ensure_dir_exists(new_server_dir)
helper.ensure_dir_exists(backup_path)
@ -344,12 +340,7 @@ class Controller:
full_jar_path = os.path.join(new_server_dir, server_jar)
if helper.is_os_windows():
server_command = 'java -Xms{}M -Xmx{}M -jar {} nogui'.format(helper.float_to_string(min_mem),
helper.float_to_string(max_mem),
'"'+full_jar_path+'"')
else:
server_command = 'java -Xms{}M -Xmx{}M -jar {} nogui'.format(helper.float_to_string(min_mem),
server_command = 'java -Xms{}M -Xmx{}M -jar {} nogui'.format(helper.float_to_string(min_mem),
helper.float_to_string(max_mem),
full_jar_path)
server_log_file = "{}/logs/latest.log".format(new_server_dir)
@ -366,8 +357,8 @@ class Controller:
if helper.is_os_windows():
new_server_dir = helper.wtol_path(new_server_dir)
backup_path = helper.wtol_path(backup_path)
new_server_dir.replace(' ', '^ ')
backup_path.replace(' ', '^ ')
new_server_dir.replace(' ', '` ')
backup_path.replace(' ', '` ')
tempDir = helper.get_os_understandable_path(zip_path)
helper.ensure_dir_exists(new_server_dir)
@ -389,12 +380,7 @@ class Controller:
full_jar_path = os.path.join(new_server_dir, server_jar)
if helper.is_os_windows():
server_command = 'java -Xms{}M -Xmx{}M -jar {} nogui'.format(helper.float_to_string(min_mem),
helper.float_to_string(max_mem),
'"'+full_jar_path+'"')
else:
server_command = 'java -Xms{}M -Xmx{}M -jar {} nogui'.format(helper.float_to_string(min_mem),
server_command = 'java -Xms{}M -Xmx{}M -jar {} nogui'.format(helper.float_to_string(min_mem),
helper.float_to_string(max_mem),
full_jar_path)
logger.debug('command: ' + server_command)
@ -412,7 +398,7 @@ class Controller:
backup_path = helper.validate_traversal(helper.backup_path, old_bu_path)
if helper.is_os_windows():
backup_path = helper.wtol_path(backup_path)
backup_path.replace(' ', '^ ')
backup_path.replace(' ', '` ')
backup_path_components = list(backup_path.parts)
backup_path_components[-1] = new_uuid
new_bu_path = pathlib.PurePath(os.path.join(*backup_path_components))

View File

@ -906,11 +906,11 @@ class PanelHandler(BaseHandler):
server_path = self.get_argument('server_path', None)
if helper.is_os_windows():
server_path = helper.wtol_path(server_path)
server_path.replace(' ', '^ ')
server_path.replace(' ', '` ')
log_path = self.get_argument('log_path', None)
if helper.is_os_windows():
log_path = helper.wtol_path(log_path)
log_path.replace(' ', '^ ')
log_path.replace(' ', '` ')
executable = self.get_argument('executable', None)
execution_command = self.get_argument('execution_command', None)
server_ip = self.get_argument('server_ip', None)
@ -981,7 +981,7 @@ class PanelHandler(BaseHandler):
backup_path = bleach.clean(self.get_argument('backup_path', None))
if helper.is_os_windows():
backup_path = helper.wtol_path(backup_path)
backup_path.replace(' ', '^ ')
backup_path.replace(' ', '` ')
else:
backup_path = server_obj.backup_path
max_backups = bleach.clean(self.get_argument('max_backups', None))