- Issue created by @penyaskito
- Status changed to Needs review
over 1 year ago 2:27pm 29 July 2023 - last update
over 1 year ago 63 pass, 1 fail - ๐ช๐ธSpain penyaskito Seville ๐, Spain ๐ช๐ธ, UTC+2 ๐ช๐บ
Attached a failing patch.
When I add a single path alias, it gets assigned the current English (only existing) language.
But if I use the node form, it gets assigned the UNDEFINED language. The last submitted patch, 2: 3377195-2.only-test.patch, failed testing. View results โ
- codesniffer_fixes.patch Interdiff of automated coding standards fixes only.- Status changed to Needs work
over 1 year ago 9:00am 30 July 2023 - ๐จ๐ญSwitzerland berdir Switzerland
Ok. I get it it now. I think the correct fix is to always look for redirects in the given language *and* UND, because that's how lookups works as well. We can do that directly within redirect_delete_by_path().
-
+++ b/tests/src/Functional/RedirectPathAliasTest.php @@ -0,0 +1,68 @@ + + /** + * {@inheritdoc} + */ + protected $profile = 'minimal';
why do wee need minimal here?
-
+++ b/tests/src/Functional/RedirectPathAliasTest.php @@ -0,0 +1,68 @@ + + // Create a redirects. + $redirect = Redirect::create(); + $redirect->setSource('/test-page'); + $redirect->setRedirect('<front>'); + $redirect->setLanguage(LanguageInterface::LANGCODE_NOT_SPECIFIED); + $redirect->setStatusCode(301); + $redirect->save();
lets create the redirect in the test, we might or might not need that in other methods.
I thought we have existing test coverage for this, but can't find it.
Would be great to extend on it a little bit, add a few more redirects, one in the matching language that should be deleted too and one with a different path that shouldn't be deleted.
For bonus points, make it multilingual, create an alias with the same path and another language that doesn't get deleted.
-
- Status changed to Needs review
over 1 year ago 2:12pm 31 July 2023 - last update
over 1 year ago 60 pass, 3 fail - last update
over 1 year ago 60 pass, 3 fail - ๐ช๐ธSpain penyaskito Seville ๐, Spain ๐ช๐ธ, UTC+2 ๐ช๐บ
Attached patch with extended tests.
I think the fix should be calling redirect_delete_by_path() with undefined language when the path alias language is the default.You said lookups works in the given language *and* UND, so I'm wondering if it should happen every time. Where are the lookups made? Maybe a @see on the changed logic could be useful.
The last submitted patch, 5: 3377195-5.only-test.patch, failed testing. View results โ
- codesniffer_fixes.patch Interdiff of automated coding standards fixes only.The last submitted patch, 5: 3377195-5.patch, failed testing. View results โ
- codesniffer_fixes.patch Interdiff of automated coding standards fixes only.- Status changed to Needs work
over 1 year ago 2:20pm 31 July 2023 - ๐จ๐ญSwitzerland berdir Switzerland
See \Drupal\redirect\RedirectRepository::findMatchingRedirect().
And I don't agree with default language condition, because default language or not has no relevance to the lookup. we always look up specific language first, UND second.
- Status changed to Needs review
over 1 year ago 7:10pm 31 July 2023 - last update
over 1 year ago 60 pass, 3 fail - last update
over 1 year ago 64 pass, 1 fail - ๐ช๐ธSpain penyaskito Seville ๐, Spain ๐ช๐ธ, UTC+2 ๐ช๐บ
Drupal\Tests\redirect_404\Kernel\Fix404RedirectCronJobTest
is failing on HEAD too, so shouldn't affect this patch.Delete the redirect unconditionally for
LANGCODE_NOT_SPECIFIED
. We might want to move that to the query avoiding two different queries. Didn't do that because the logic for$match_subpaths_and_redirect
might change too and I'm not aware when and how that's used. The last submitted patch, 9: 3377195-9.only-test.patch, failed testing. View results โ
- codesniffer_fixes.patch Interdiff of automated coding standards fixes only.The last submitted patch, 9: 3377195-9.patch, failed testing. View results โ
- codesniffer_fixes.patch Interdiff of automated coding standards fixes only.- last update
over 1 year ago 67 pass - last update
over 1 year ago 63 pass, 2 fail - ๐ช๐ธSpain penyaskito Seville ๐, Spain ๐ช๐ธ, UTC+2 ๐ช๐บ
The failing test in unrelated, so setting this as NR.
The last submitted patch, 9: 3377195-9.only-test.patch, failed testing. View results โ
- codesniffer_fixes.patch Interdiff of automated coding standards fixes only.- ๐ฎ๐ณIndia ighosh
ishanghosh27 โ made their first commit to this issueโs fork.
- Open on Drupal.org โCore: 9.5.x + Environment: PHP 7.4 & MySQL 5.7last update
about 1 year ago Not currently mergeable. - @ishanghosh27 opened merge request.
- ๐ฎ๐ณIndia vishal prasad
Vishal Prasad โ made their first commit to this issueโs fork.
- Merge request !60Issue #3377195: Redirects not deleted on alias creation on monolingual sites โ (Closed) created by vishal prasad
- last update
about 1 year ago 60 pass, 1 fail - Assigned to ighosh
- ๐ฎ๐ณIndia ighosh
Applied Patch - 3377195-9.patch by penyaskito โ . Working as expected. Reviewed and tested at my end.
- Issue was unassigned.
- Status changed to RTBC
5 months ago 6:37am 12 June 2024 - ๐ฎ๐ณIndia vishal prasad
@Berdir I have tested the 3377195-9.patch by @penyaskito and it works good to me too,
i think we can create a MR and Merge it. - Status changed to Needs work
4 months ago 7:39am 10 August 2024 - ๐จ๐ญSwitzerland berdir Switzerland
I don't understand why there are two closed MR's here with no changes. The patch should be converted to a merge request so that we can run current tests against it.
- ๐ฎ๐ณIndia ighosh
@berdir I had accidentally opened an MR as this was the first time I was contributing to open source and got confused about what was required for this issue (Testing the patch). Later, I closed the MR and tested the existing patch. Hope this clarifies the query.