Query string parser generates array as value
Opened this issue · 2 comments
src/js/helpers/uri.js:44
generates an array when multiple values exist with the same key.
An exmaple URL would be http://example.com/?utm_source=google&utm_source=google
The uri helper generates an array of ["google", "google"]
for utm_source which gets cast to a string later via string concatenation.
The end result when I access sbjs.get.current.src
is "google,google"
which is not what you would expect.
The expected result would be to ignore the duplicate values and sbjs.get.current.src
should just be "google"
.
I agree that who ever set up the google integration for the project I'm working is an idiot for duplicating everything and that absolutely needs fixing.
Still, it was very difficult to debug and sbjs should not rely on magically casting arrays to string. It should also use a standard query string parser rather than a custom one. These are just bad practises and should eventually be fixed in this project as well.