1
0
mirror of https://github.com/yt-dlp/yt-dlp.git synced 2026-02-20 15:35:44 +00:00

[jsinterp] Support string concatenation with + and += (#15990)

Authored by: bashonly
This commit is contained in:
bashonly
2026-02-17 17:46:20 -06:00
committed by GitHub
parent c9c8651975
commit d108ca10b9
2 changed files with 12 additions and 0 deletions

View File

@@ -376,6 +376,10 @@ class JSInterpreter:
if not _OPERATORS.get(op):
return right_val
# TODO: This is only correct for str+str and str+number; fix for str+array, str+object, etc
if op == '+' and (isinstance(left_val, str) or isinstance(right_val, str)):
return f'{left_val}{right_val}'
try:
return _OPERATORS[op](left_val, right_val)
except Exception as e: