🐛 Removed invalid char in output file

This commit is contained in:
Nikhil Badyal
2023-07-14 07:18:23 +05:30
parent bf394df92b
commit 90c4463c5f
2 changed files with 23 additions and 2 deletions
+2 -2
View File
@@ -8,7 +8,7 @@ from loguru import logger
from src.config import RevancedConfig
from src.patches import Patches
from src.utils import possible_archs
from src.utils import possible_archs, slugify
class Parser(object):
@@ -100,7 +100,7 @@ class Parser(object):
"-m",
integrations,
"-o",
f"Re-{app}-{version}{output_prefix}output.apk",
f"Re-{app}-{slugify(version)}{output_prefix}output.apk",
"--keystore",
self.config.keystore_name,
"--options",
+21
View File
@@ -1,4 +1,5 @@
"""Utilities."""
import re
from typing import Dict
from loguru import logger
@@ -55,3 +56,23 @@ def handle_response(response: Response) -> None:
if response_code != 200:
logger.error(response.text)
exit(1)
def slugify(string: str) -> str:
"""Converts a string to a slug format."""
# Convert to lowercase
string = string.lower()
# Remove special characters
string = re.sub(r"[^\w\s-]", "", string)
# Replace spaces with dashes
string = re.sub(r"\s+", "-", string)
# Remove consecutive dashes
string = re.sub(r"-+", "-", string)
# Remove leading and trailing dashes
string = string.strip("-")
return string