mirror of
https://github.com/Benexl/FastAnime.git
synced 2025-12-05 20:40:09 -08:00
feat: sanitize " in key
This commit is contained in:
@@ -26,7 +26,7 @@ SCALE_UP = "{SCALE_UP}" == "True"
|
||||
|
||||
# fzf passes the title with quotes, so we need to trim them
|
||||
TITLE = sys.argv[1]
|
||||
KEY = "{KEY}"
|
||||
KEY = """{KEY}"""
|
||||
KEY = KEY + "-" if KEY else KEY
|
||||
|
||||
hash = f"{PREFIX}-{sha256((KEY + TITLE).encode('utf-8')).hexdigest()}"
|
||||
|
||||
@@ -6,6 +6,8 @@ from typing import Dict, List, Optional
|
||||
|
||||
import httpx
|
||||
|
||||
from viu_media.core.utils import formatter
|
||||
|
||||
from ...core.config import AppConfig
|
||||
from ...core.constants import APP_CACHE_DIR, PLATFORM, SCRIPTS_DIR
|
||||
from ...core.utils.file import AtomicWriter
|
||||
@@ -359,7 +361,7 @@ def get_episode_preview(
|
||||
"HEADER_COLOR": ",".join(HEADER_COLOR),
|
||||
"SEPARATOR_COLOR": ",".join(SEPARATOR_COLOR),
|
||||
"PREFIX": "episode",
|
||||
"KEY": f"{media_item.title.english}",
|
||||
"KEY": f"{media_item.title.english.replace(formatter.DOUBLE_QUOTE, formatter.SINGLE_QUOTE)}",
|
||||
"SCALE_UP": str(config.general.preview_scale_up),
|
||||
}
|
||||
|
||||
|
||||
@@ -307,7 +307,9 @@ class EpisodeCacheWorker(ManagedBackgroundWorker):
|
||||
streaming_episodes = media_item.streaming_episodes
|
||||
|
||||
for episode_str in episodes:
|
||||
hash_id = self._get_cache_hash(f"{media_item.title.english}-{episode_str}")
|
||||
hash_id = self._get_cache_hash(
|
||||
f"{media_item.title.english.replace(formatter.DOUBLE_QUOTE, formatter.SINGLE_QUOTE)}-{episode_str}"
|
||||
)
|
||||
|
||||
# Find episode data
|
||||
episode_data = streaming_episodes.get(episode_str)
|
||||
|
||||
@@ -5,6 +5,8 @@ from typing import Dict, List, Optional, Union
|
||||
from ...libs.media_api.types import AiringSchedule
|
||||
|
||||
COMMA_REGEX = re.compile(r"([0-9]{3})(?=\d)")
|
||||
SINGLE_QUOTE = "'"
|
||||
DOUBLE_QUOTE = '"'
|
||||
|
||||
|
||||
def format_media_duration(total_minutes: Optional[int]) -> str:
|
||||
|
||||
Reference in New Issue
Block a user