I had a little issue with pathologic and wanted to create tests for this case. But even before starting to work on this I started the "Pathologic path filtering" test case to see the result. It showed 5 fails, 4 with 'Path with just slash' and one with '"Also considered local" paths'.
The modification to make the "path with just slash" was pretty simple:
if ($parts['trimmed_path'] === '') {
# become
if ($parts['trimmed_path'] === '' || $parts['trimmed_path'] === '/') {
The '"Also considered local" paths' was much harder to get pass.
# there was a typo in the test:
'local_paths' => "http://example.com/qux\nexample.org\/bananas",
#become
'local_paths' => "http://example.com/qux\nexample.org\n/bananas",
# i also added a clean_url reset before making the last tests
variable_set('clean_url', TRUE);
In the _pathologic_filter function the $parts needed to be rebuild if the expolded path was just a domain. This was especially done for the example.org path in the '"Also considered local" paths' test.
In _pathologic_replace the local_path is kept in a variable. This was needed to clean the url in cases where the local path point to a subdirectory (http://example.com/qux).
| Comment | File | Size | Author |
|---|---|---|---|
| #4 | tests_pass_and_language_prefix-1426928-4.patch | 7.08 KB | idflood |
| #3 | tests_pass_and_language_prefix-1426928-3.patch | 7.64 KB | idflood |
| #2 | tests_pathologic_pass-1426928-2.patch | 3.81 KB | idflood |
| #1 | tests_pathologic_pass-1426928-1.patch | 4.1 KB | idflood |
Comments
Comment #1
idflood commentedComment #2
idflood commentedLittle cleanup of previous patch, removed the unnecessary 'if ($parts['trimmed_path'] === '')' modification since there is now a function that remove the starting / just before.
Comment #3
idflood commentedHere is a patch that combines the one in #2 and the second patch of #71 in #348421: Multilingual links with Pathologic.
It needs more testing but it fixes the tests and the issues I had on a website.
Comment #4
idflood commentedNew patch that simplify the language handling. Combine patch from #2 with the patch in #73 from #348421: Multilingual links with Pathologic.
Comment #5
palamida commentedSo far so good...
applied patch #4 and pictures are ok
going to do some more testing... (maybe something wrong with linkit... missing language prefix - but must check)
Comment #6
Garrett Albright commentedidflood, I didn't want to use the first part of your patch which tried to guess if a path actually had a host part or not - I'm worried it will introduce ambiguity - but as for the rest of the things you address, do you think you could take a look at the Beta 2 release and see how it goes for you?
Comment #7
idflood commentedI tried today with the latest 2.x-dev version from git. It fixes all the previous tests but still fail on the new language handling test. I close this issue since the only remaining bug is specific to #348421: Multilingual links with Pathologic
Comment #7.0
idflood commentedtypo