After we upgraded from 2.0.7 to 2.0.8, all custom breadcrumbs under "Paths to replace with custom breadcrumbs" disappeared and the only displayed part is "Home".
The custom breadcrumb is quite straightforward like "/path :: Part 1 | /part_1"
| Comment | File | Size | Author |
|---|---|---|---|
| #16 | 3480899-easy_breadcrumb-with-patch.png | 102.66 KB | capysara |
| #16 | 3480899-easy_breadcrumb-without-patch.png | 105.77 KB | capysara |
Issue fork easy_breadcrumb-3480899
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #2
greg boggsoph. Thanks for the report. We'll take a look as soon as we can. Clearly we need better test coverage for this feature.
Comment #3
odenscAppears to be caused by https://git.drupalcode.org/project/easy_breadcrumb/-/commit/e4109f3f4851... (issue #3271576). Now instead of trimming leading *and* trailing slashes from $path, it only removes trailing slashes.
This conflicts with line 321 where the $custom_path is trimmed on both sides.
So we run into a scenario where they don't match:
$path: /path-1
$custom_path: path-1
We could make line 321 only trim spaces from both sides, and then add an
rtrimbelow for the slashes so it matches the behavior of $path, but that would be a breaking change if someone has a custom path config with multiple leading slashes. (unlikely, but possible).Comment #4
greg boggsI think it's reasonably safe to assume someone doesn't have a custom path with multiple leading slashes.
Comment #5
greg boggsIt's off topic, but I work for our library. Thanks for all the great work y'all do at City of Portland. Feel encouraged to open an MR with what you think the best fix is here.
Comment #7
odenscHowdy neighbor! Appreciate your work as well.
I did some more digging on this, I think #3271576 (the source of this regression) was actually a "duplicate" bugfix. The same bug was fixed on Feb 3, 2022 in #3262378 with a different approach in `getRequestForPath` of adding a leading slash if it doesn't exist.
That fix didn't make it into a release (v2.0.3) until Jun 5, 2022. In the meantime, on Mar 24, 2022, #3271576 was opened. In July 2022, a couple users in the comments appear to have the same issue, I suspect due to an outdated module version. This bug should be theoretically impossible with v2.0.3, released a month prior.
This ultimately leads to a redundant bugfix being merged and released in v2.0.8.
Anyway. Sorry for the unprompted history lesson. I submitted an MR that:
<title>placeholder. This appears to have been a missed followup from #3271576.Comment #8
odenscFound an issue with the alternative title logic. Let me take that MR back for a bit.Comment #9
odenscComment #10
angelamnr commentedThe merge request patch is working for me with easy_breadcrumb 2.0.8. I appreciate all the background information, too!
Comment #11
greg boggsMy only question is on this line:
- $title = Html::decodeEntities(Xss::filter(trim($settings[0])));
Are we still escaping JavaScript if we remove that line?
Comment #12
greg boggsAlso! Great freaking work on this merge request. Tests and everything.
Comment #13
odenscGood question, it wasn't completely removed but just moved lower down.
So yes, it will still do the XSS filtering, but now after the placeholder title/regex replacements are done. I moved it because I noticed when using the placeholder, it wasn't getting filtered or trimmed.
Comment #14
greg boggsAwesome couldn't tell for certain the Diff, thanks for the extra info!
Comment #15
greg boggsCode looks good. Needs some more manual testing still. We'll wait for Spuky to take a look.
~G
Comment #16
capysara commentedI manually tested and can confirm this patch resolves the issue described. Tested on a clean install with easy_breadcrumb 2.x and core standard install 10.3.7-dev.
* Create a basic page, with title Page 1 and alias `/test`

* View page and confirm breadcrumbs are Home -> Page 1
* Update easy_breadcrumbs config—add Paths to replace with custom breadcrumbs: `/test :: Capybara | /test`
* Confirm breadcrumbs are unchanged
* Apply patch and clear cache
* Confirm breadcrumbs now correctly display Home -> Capybara
Without patch:
With patch:

Comment #19
nickdickinsonwildeFantastic improvements, merging.
Comment #20
nickdickinsonwilde