fix(parallel): add maxsplit=1 to prevent ValueError on values containing '='#4175
Conversation
Without maxsplit, any argument value containing '=' (base64 padding,
URLs with query strings, JSON values, etc.) causes split("=") to return
more than 2 elements, raising ValueError: too many values to unpack.
Fixes microsoft#4174
|
Hi, thank you for your interest in helping to improve the prompt flow experience and for your contribution. We've noticed that there hasn't been recent engagement on this pull request. If this is still an active work stream, please let us know by pushing some changes or leaving a comment. |
|
@devteamaegis please read the following Contributor License Agreement(CLA). If you agree with the CLA, please reply with the following information.
Contributor License AgreementContribution License AgreementThis Contribution License Agreement (“Agreement”) is agreed to by the party signing below (“You”),
|
What's broken
_parse_prefixed_args()insrc/promptflow-parallel/promptflow/parallel/_config/parser.pycrashes withValueError: too many values to unpack (expected 2)whenever an argument value contains the=character. This affects base64-encoded values (which use=as padding), URLs with query strings, and any other value embedding=. For example, passing--pf_input_token=SGVsbG8gV29ybGQ=(base64 for "Hello World") raises the error immediately.Why it happens
Line 88 calls
arg.split("=")with nomaxsplit, so a value likename=base64==splits into three elements and the two-variable unpack fails.Fix
Changed
arg.split("=")toarg.split("=", 1)so only the first=is used as the name/value delimiter. The rest of the string is preserved intact as the value.Test
Added
test_parse_prefixed_args_value_with_equalstotests/parallel/unittests/_config/test_parse.py. It passes a base64-padded token argument and asserts the full value (including trailing=) is parsed correctly without raising.Fixes #4174