dbt_utils.get_url_parameter
will incorrectly match fields if they end with url_parameter
#980
Open
1 of 5 tasks
Describe the bug
Steps to reproduce
When using
dbt_utils.get_url_parameter
it will incorrectly match on shortFor example when doing the following and the url field values is
http://www.test.com?msg=myvalue
it will incorrectly return "myvalue".dbt_utils.get_url_parameter(field='url', url_parameter='g')
Expected results
In the above scenario, it should only exact match the URL parameter and return null
Actual results
It matches and returns "myvalue"
System information
The contents of your
packages.yml
file:Which database are you using dbt with?
The output of
dbt --version
:Additional context
I believe it's this implementation here https://github.com/dbt-labs/dbt-utils/blob/main/macros/web/get_url_parameter.sql#L5
Are you interested in contributing the fix?
I've switched to using the following but not sure this solution is entirely correct either
nullif(regexp_substr({{ field }}, '[?&]{{ url_parameter }}=([^&]+)', 1, 1, 'e'), '')
The text was updated successfully, but these errors were encountered: