mirror of
https://gitlab.com/crafty-controller/crafty-4.git
synced 2024-08-30 18:23:09 +00:00
Merge branch 'bugfix/server-files-feedback' into 'dev'
Provide Feedback on Delete Fail See merge request crafty-controller/crafty-4!699
This commit is contained in:
commit
8fbd28b9c6
@ -10,6 +10,7 @@
|
|||||||
- Fix bug where invalid server Id leads to stack ([Merge Request](https://gitlab.com/crafty-controller/crafty-4/-/merge_requests/690))
|
- Fix bug where invalid server Id leads to stack ([Merge Request](https://gitlab.com/crafty-controller/crafty-4/-/merge_requests/690))
|
||||||
- Fix indent on public status check box ([Merge Request](https://gitlab.com/crafty-controller/crafty-4/-/merge_requests/691))
|
- Fix indent on public status check box ([Merge Request](https://gitlab.com/crafty-controller/crafty-4/-/merge_requests/691))
|
||||||
- Fix unicode chars in terminal & logs w/ textiowrapper ([Merge Request](https://gitlab.com/crafty-controller/crafty-4/-/merge_requests/689))
|
- Fix unicode chars in terminal & logs w/ textiowrapper ([Merge Request](https://gitlab.com/crafty-controller/crafty-4/-/merge_requests/689))
|
||||||
|
- Provide feedback on file delete failure ([Merge Request](https://gitlab.com/crafty-controller/crafty-4/-/merge_requests/699))
|
||||||
### Tweaks
|
### Tweaks
|
||||||
- Refactor Forge server initialisation flow for newer versions ([Merge Request](https://gitlab.com/crafty-controller/crafty-4/-/merge_requests/687))
|
- Refactor Forge server initialisation flow for newer versions ([Merge Request](https://gitlab.com/crafty-controller/crafty-4/-/merge_requests/687))
|
||||||
- Remove scroll bars from player management ([Merge Request](https://gitlab.com/crafty-controller/crafty-4/-/merge_requests/693))
|
- Remove scroll bars from player management ([Merge Request](https://gitlab.com/crafty-controller/crafty-4/-/merge_requests/693))
|
||||||
|
@ -35,8 +35,9 @@ class FileHelpers:
|
|||||||
try:
|
try:
|
||||||
# This removes the top-level folder:
|
# This removes the top-level folder:
|
||||||
path.rmdir()
|
path.rmdir()
|
||||||
except:
|
except Exception as e:
|
||||||
logger.error("Unable to remove top level")
|
logger.error("Unable to remove top level")
|
||||||
|
return e
|
||||||
return True
|
return True
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
@ -47,9 +48,9 @@ class FileHelpers:
|
|||||||
# Remove the file
|
# Remove the file
|
||||||
os.remove(path)
|
os.remove(path)
|
||||||
return True
|
return True
|
||||||
except FileNotFoundError:
|
except (FileNotFoundError, PermissionError) as e:
|
||||||
logger.error(f"Path specified is not a file or does not exist. {path}")
|
logger.error(f"Path specified is not a file or does not exist. {path}")
|
||||||
return False
|
return e
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def copy_dir(src_path, dest_path, dirs_exist_ok=False):
|
def copy_dir(src_path, dest_path, dirs_exist_ok=False):
|
||||||
|
@ -237,10 +237,14 @@ class ApiServersServerFilesIndexHandler(BaseApiHandler):
|
|||||||
)
|
)
|
||||||
|
|
||||||
if os.path.isdir(data["filename"]):
|
if os.path.isdir(data["filename"]):
|
||||||
FileHelpers.del_dirs(data["filename"])
|
proc = FileHelpers.del_dirs(data["filename"])
|
||||||
else:
|
else:
|
||||||
FileHelpers.del_file(data["filename"])
|
proc = FileHelpers.del_file(data["filename"])
|
||||||
return self.finish_json(200, {"status": "ok"})
|
# disabling pylint because return value could be truthy
|
||||||
|
# but not a true boolean value
|
||||||
|
if proc == True: # pylint: disable=singleton-comparison
|
||||||
|
return self.finish_json(200, {"status": "ok"})
|
||||||
|
return self.finish_json(500, {"status": "error", "error": str(proc)})
|
||||||
|
|
||||||
def patch(self, server_id: str):
|
def patch(self, server_id: str):
|
||||||
auth_data = self.authenticate_user()
|
auth_data = self.authenticate_user()
|
||||||
|
Loading…
Reference in New Issue
Block a user