[BUGFIX] Fix source vars containing variable-like syntax

This commit is contained in:
Jesse Bannon 2022-09-13 22:59:14 -07:00
parent c9f0300b39
commit 3673a07249
2 changed files with 9 additions and 4 deletions

View file

@ -115,7 +115,12 @@ class BaseEntry(BaseEntryVariables, ABC):
"""Returns an internal kwarg value supplied from ytdl"""
if not self.kwargs_contains(key):
raise KeyError(f"Expected '{key}' in {self.__class__.__name__} but does not exist.")
return self._kwargs[key]
output = self._kwargs[key]
# Replace curly braces with unicode version to avoid variable shenanigans
if isinstance(output, str):
return output.replace("{", "").replace("}", "")
return output
def kwargs_get(self, key: str, default: Optional[Any] = None) -> Any:
"""

View file

@ -16,7 +16,7 @@ def extractor():
@pytest.fixture
def title():
return "entry title"
return "entry {title}"
@pytest.fixture
@ -61,8 +61,8 @@ def mock_entry_to_dict(
):
return {
"uid": uid,
"title": title,
"title_sanitized": title,
"title": "entry title",
"title_sanitized": "entry title",
"ext": ext,
"extractor": extractor,
"upload_date": upload_date,