1
0
Fork 0

[jsinterp] Fix _separate

Ref: https://github.com/yt-dlp/yt-dlp/issues/4635#issuecomment-1231126941
This commit is contained in:
pukkandan 2022-08-30 15:57:17 +05:30
commit c4b2df872d
No known key found for this signature in database
GPG key ID: 7EEE9E1E817D0A39
4 changed files with 8 additions and 4 deletions

View file

@ -226,7 +226,7 @@ class JSInterpreter:
@staticmethod
def _separate(expr, delim=',', max_split=None):
OP_CHARS = '+-*/%&|^=<>!,;'
OP_CHARS = '+-*/%&|^=<>!,;{}()[]:'
if not expr:
return
counters = {k: 0 for k in _MATCHING_PARENS.values()}
@ -243,7 +243,7 @@ class JSInterpreter:
elif in_quote == '/' and char in '[]':
in_regex_char_group = char == '['
escaping = not escaping and in_quote and char == '\\'
after_op = not in_quote and char in OP_CHARS or (char == ' ' and after_op)
after_op = not in_quote and char in OP_CHARS or (char.isspace() and after_op)
if char != delim[pos] or any(counters.values()) or in_quote:
pos = 0