- πΊπΈUnited States dpagini
+1 for this patch, it solves the same problem I'm facing... Url's in the "From" field with a special character, like `path/to/a%20file.pdf` won't work.
This issue has been RTBC for almost a year now, is there anything left the maintainers need on this issue? I see that, it appears, the last requested changes by Berdir were completed, so I think this just needs eyes again from an maintainer. - Status changed to Needs work
almost 2 years ago 10:01am 4 March 2023 - π¨πSwitzerland berdir Switzerland
I'm concerned about the upgrade path. I maintain sites with tens and hundreds of thousands of redirects, a forced upgrade path that will recalculate the hash for all of them is going to take time and could possibly mean quite a long downtime for a site of that size. What about adding a button to the settings page to do recalculate hashes, and the update function could just add a message that people might want to run that? We could reuse that if other changes need to happen.
The cache tag handling is also not correct, the list cache tag is mostly just for render caching, the entity storage will still cache those entries, should either invalidate them all through EntityStorageInterface::resetCache() or alternatively the specific entities that are being changed here.
+++ b/tests/src/Kernel/RedirectAPITest.php @@ -62,6 +62,10 @@ class RedirectAPITest extends KernelTestBase { $this->assertEquals(Redirect::generateHash('some-url', ['key1' => 'val1'], Language::LANGCODE_NOT_SPECIFIED), $redirect->getHash()); + // Update the redirect source with a + sign in it. + $redirect->setSource('some+url'); + $redirect->save(); + $this->assertEquals(Redirect::generateHash('some url', [], Language::LANGCODE_NOT_SPECIFIED), $redirect->getHash()); // Update the redirect source path and check if hash has been updated as
this isn't testing much because it would also pass on HEAD, it's just testing that the hash is generated. We probably want to hardcode the hash for that case.