Skip to content

Commit

Permalink
fix(URLExtract): use builtin parser
Browse files Browse the repository at this point in the history
  • Loading branch information
floryst committed Jan 23, 2025
1 parent d69dde4 commit cf8a3b1
Showing 1 changed file with 2 additions and 7 deletions.
9 changes: 2 additions & 7 deletions Sources/Common/Core/URLExtract/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,13 +39,8 @@ function extractURLParameters(
) {
const summary = {};
const convert = castToNativeType ? toNativeType : identity;
const queryTokens = (query || '')
.replace(/#.*/, '') // remove hash query
.replace('?', '') // Remove ? from the head
.split('&'); // extract token pair

queryTokens.forEach((token) => {
const [key, value] = token.split('=').map((s) => decodeURIComponent(s));
const params = new URLSearchParams(query);
params.forEach((value, key) => {
if (key) {
summary[key] = value ? convert(value) : true;
}
Expand Down

0 comments on commit cf8a3b1

Please sign in to comment.