Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@didoda
Copy link
Member

@didoda didoda commented Feb 2, 2023

This fixes an unexpected behaviour.

Actual Behaviour

When opening an url /lang?new=:lang, with no referer, I18nMiddleware throws an exception [Cake\Http\Exception\BadRequestException] "redirect" query string not valid.

Expected Behaviour

When opening an url /lang?new=:lang, with no referer, I18nMiddleware redirects to /.

@didoda didoda added enhancement New feature or request release:patch labels Feb 2, 2023
@didoda didoda changed the title Switch lang when no referer redirects to "/" Switch lang when no referer throw BadRequestException, it should redirect to "/" Feb 2, 2023
@didoda didoda changed the title Switch lang when no referer throw BadRequestException, it should redirect to "/" Fix /lang?new=:lang with no referer throws BadRequestException Feb 2, 2023
@codecov
Copy link

codecov bot commented Feb 2, 2023

Codecov Report

Base: 98.67% // Head: 98.80% // Increases project coverage by +0.13% 🎉

Coverage data is based on head (a243a84) compared to base (b07496b).
Patch coverage: 100.00% of modified lines in pull request are covered.

Additional details and impacted files
@@             Coverage Diff              @@
##             master      #77      +/-   ##
============================================
+ Coverage     98.67%   98.80%   +0.13%     
- Complexity      133      135       +2     
============================================
  Files             6        6              
  Lines           376      419      +43     
============================================
+ Hits            371      414      +43     
  Misses            5        5              
Impacted Files Coverage Δ
src/Middleware/I18nMiddleware.php 100.00% <100.00%> (ø)
src/Plugin.php 100.00% <0.00%> (ø)
src/View/Helper/I18nHelper.php 100.00% <0.00%> (ø)
src/Command/GettextCommand.php 97.51% <0.00%> (+0.43%) ⬆️

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

☔ View full report at Codecov.
📢 Do you have feedback about the report comment? Let us know in this issue.

@stefanorosanelli stefanorosanelli merged commit 982e0c7 into bedita:master Feb 2, 2023
@didoda didoda deleted the feat/i18n-middleware-default-redirect branch February 2, 2023 16:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request release:patch

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants