Avoid corrupting media URLs with query strings by coreh · Pull Request #1748 · EvolutionAPI/evolution-api · GitHub
Skip to content

Avoid corrupting media URLs with query strings#1748

Merged
DavidsonGomes merged 1 commit intoEvolutionAPI:developfrom
coreh:fix-url-corruption-querystring
Jul 25, 2025
Merged

Avoid corrupting media URLs with query strings#1748
DavidsonGomes merged 1 commit intoEvolutionAPI:developfrom
coreh:fix-url-corruption-querystring

Conversation

@coreh
Copy link
Copy Markdown
Contributor

@coreh coreh commented Jul 23, 2025

The existing logic was naively concatenating ?timestamp=... to the end of media URLs, which resulted in corrupted URLs with two ? whenever the URLs already had a query string.

We now use new URL() and searchParams APIs to parse and update the URL

Summary by Sourcery

Use URL and URLSearchParams APIs to append timestamp query parameters to media URLs instead of naive string concatenation, preventing URL corruption when existing query parameters are present.

Bug Fixes:

  • Prevent double '?' in media URLs by correctly handling existing query strings when adding timestamp parameters

Enhancements:

  • Replace manual query string concatenation with URL("...").searchParams.set in multiple media-fetching methods

@sourcery-ai
Copy link
Copy Markdown
Contributor

sourcery-ai Bot commented Jul 23, 2025

Copy link
Copy Markdown
Contributor

@sourcery-ai sourcery-ai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey @coreh - I've reviewed your changes and they look great!


Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

@DavidsonGomes DavidsonGomes changed the base branch from main to develop July 25, 2025 19:55
@DavidsonGomes DavidsonGomes merged commit c66485e into EvolutionAPI:develop Jul 25, 2025
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.

2 participants