-
Notifications
You must be signed in to change notification settings - Fork 4.1k
getNameArgs in variables.js doesn't understand nested macros #21751
Copy link
Copy link
Closed
Description
We have a function export function getNameArgs that extracts the name from the arguments in our macros. encodeVars relies on this function to not encode the arguments to a macro which will later be resolved by UrlReplacementService. This does not work for nested macros and thus the arguments get encoded and everything breaks.
example:
encodeVars(SOME_MACRO(abc,123)) == SOME_MACRO(abc,123)
encodeVars(SOME_MACRO(abc, OTHER_MACRO(foo))) == SOME_MACRO(abc%2C%20OTHER_MACRO(foo))
This could be fixed by altering the regex here to be smart about nested macros.
| const VARIABLE_ARGS_REGEXP = /^(?:([^\s]*)(\([^)]*\))|[^]+)$/; |
cc/ @ampproject/wg-analytics
Reactions are currently unavailable