Skip to content

fix: prevent double '?' when custom apiUrl already contains query string#106

Open
unsiqasik wants to merge 1 commit into
cloudflare:mainfrom
unsiqasik:fix/query-string-double-question
Open

fix: prevent double '?' when custom apiUrl already contains query string#106
unsiqasik wants to merge 1 commit into
cloudflare:mainfrom
unsiqasik:fix/query-string-double-question

Conversation

@unsiqasik
Copy link
Copy Markdown

Fixes #105

Summary

When downloadApiUrl or uploadApiUrl already contain a query string (e.g., ?token=***), the engine appends its own params with a literal ? separator, producing a malformed URL with two ? characters.

Changes

  • BandwidthEngine.js: Check if apiUrl already contains ? — use & as separator if so, otherwise use ?
  • LoadNetworkEngine/index.js: Same fix for the fetch URL construction

Testing

  • URLs without existing query strings still work as before (?bytes=...)
  • URLs with existing query strings now correctly append with & (e.g., ?token=***&bytes=...)

When custom downloadApiUrl/uploadApiUrl already contain a query string
(e.g., '?token=***'), the engine was appending another '?' producing a
malformed URL. Now checks for existing '?' and uses '&' as separator.

Fixes cloudflare#105
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Custom downloadApiUrl/uploadApiUrl with an existing query string breaks (double ?)

2 participants