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

Allow the extra path to be ignored when redirecting #2298

Merged
merged 2 commits into from
Dec 1, 2024

Conversation

acelaya
Copy link
Member

@acelaya acelaya commented Dec 1, 2024

Closes #2265

Add a new REDIRECT_EXTRA_PATH_MODE option to have more granularity when it comes to matching short URLs with extra path.

Up until now it was possible to set REDIRECT_APPEND_EXTRA_PATH with values true or false. When true, short URLs would only match if the visited path was exactly the short code or custom slug of a URL. When false, they would match as long as they started with the short code or custom slug, and the rest of the path would be appended to the long URL before redirecting.

The new option replaces this one by providing extra path modes:

  • default: Same as setting REDIRECT_APPEND_EXTRA_PATH to false.
  • append: Same as setting REDIRECT_APPEND_EXTRA_PATH to true.
  • ignore: Will match short URLs using the same logic as append, but the extra path will be discarded instead.

With this PR REDIRECT_APPEND_EXTRA_PATH becomes deprecated and marked for removal in Shlink 5.0.0

Copy link

codecov bot commented Dec 1, 2024

Codecov Report

Attention: Patch coverage is 50.00000% with 7 lines in your changes missing coverage. Please review.

Project coverage is 93.64%. Comparing base (ede58ef) to head (d83081f).
Report is 4 commits behind head on develop.

Files with missing lines Patch % Lines
...le/Core/src/Config/Options/UrlShortenerOptions.php 0.00% 7 Missing ⚠️
Additional details and impacted files
@@              Coverage Diff              @@
##             develop    #2298      +/-   ##
=============================================
- Coverage      93.70%   93.64%   -0.07%     
- Complexity      1657     1661       +4     
=============================================
  Files            275      275              
  Lines           5782     5790       +8     
=============================================
+ Hits            5418     5422       +4     
- Misses           364      368       +4     

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

@acelaya acelaya marked this pull request as ready for review December 1, 2024 11:28
@acelaya acelaya merged commit bfaab6c into shlinkio:develop Dec 1, 2024
29 of 31 checks passed
@acelaya acelaya deleted the feature/ignore-extra-path branch December 1, 2024 11:37
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.

Config option to ignore extra paths
1 participant