clense path from weird characters

This commit is contained in:
leminlimez
2025-03-20 23:08:54 -04:00
parent f1c6f16f84
commit 55b5e45e51

View File

@@ -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: