Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ensure query parameters are preserved verbatim when forwarded to long URL #2214

Merged
merged 1 commit into from
Oct 10, 2024

Conversation

acelaya
Copy link
Member

@acelaya acelaya commented Oct 10, 2024

Closes #2213

When merging request query params with the long URL ones, right before redirecting, this PR makes sure the request ones are parsed manually so that they are preserved verbatim.

By using $request->getQueryParams() we were getting affected by a historical decisions in PHP, where query params are promoted as vars, and therefore, characters not allowed in variable names (like spaces) where replaced by something else.

Since we do not rely in this side effect, manually parsing the query string prevents this behavior and preserves params with "special" chars verbatim.

@@ -7,7 +7,7 @@ return [
'rabbitmq' => [
'enabled' => true,
'host' => 'shlink_rabbitmq',
'port' => '5672',
'port' => 5672,
Copy link
Member Author

Choose a reason for hiding this comment

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

This change is unrelated to this PR, but it was causing an error when connecting to RabbitMQ.

Production config was not affected, as the port was converted to int in there.

Copy link

codecov bot commented Oct 10, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 94.73%. Comparing base (15b53ef) to head (1773e6e).
Report is 1 commits behind head on develop.

Additional details and impacted files
@@            Coverage Diff             @@
##             develop    #2214   +/-   ##
==========================================
  Coverage      94.73%   94.73%           
  Complexity      1551     1551           
==========================================
  Files            269      269           
  Lines           5200     5200           
==========================================
  Hits            4926     4926           
  Misses           274      274           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@acelaya acelaya merged commit 3a4a27a into shlinkio:develop Oct 10, 2024
31 checks passed
@acelaya acelaya deleted the feature/fix-query-params branch October 10, 2024 09:38
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.

Query params replacing space (%20) with underscore (_)
1 participant