mirror of
https://github.com/leminlimez/Nugget.git
synced 2025-04-08 04:23:05 +08:00
clense path from weird characters
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
import os
|
||||
import zipfile
|
||||
import uuid
|
||||
import re
|
||||
from random import randint
|
||||
from PySide6 import QtWidgets, QtCore, QtGui
|
||||
|
||||
@@ -87,6 +88,10 @@ class PosterboardTweak(Tweak):
|
||||
return None
|
||||
|
||||
|
||||
def clean_path_name(self, path: str):
|
||||
return re.sub('[^a-zA-Z0-9\.\/\-_ ]', '', path)
|
||||
|
||||
|
||||
def recursive_add(self,
|
||||
files_to_restore: list[FileToRestore],
|
||||
curr_path: str, restore_path: str = "",
|
||||
@@ -116,7 +121,7 @@ class PosterboardTweak(Tweak):
|
||||
files_to_restore.append(FileToRestore(
|
||||
contents=new_contents,
|
||||
contents_path=contents_path,
|
||||
restore_path=f"{restore_path}/{folder_name}",
|
||||
restore_path=self.clean_path_name(f"{restore_path}/{folder_name}"),
|
||||
domain=f"AppDomain-{self.bundle_id}"
|
||||
))
|
||||
except IOError:
|
||||
|
||||
Reference in New Issue
Block a user