Hello,
I have an issue on a project I am working on.
On a page where the title has a "&", it is double escaped.
How to reproduce the bug?
On a fresh drupal install:
- Install easy breadcrumb module version 1.12
- Enable easy breadcrumb module and configure the module :
"Include the current page as a segment in the breadcrumb"
"Include the front page as a segment in the breadcrumb"
"Use the real page title when available"
"Use menu title when available"
"Make the language path prefix a segment"
- Create a new page view with title: "Test & Bug"
Then, on your page, you will see "Home > Test & Bug".
See attached screenshots.
I tracked down the bug and compare to menu breacrumb or core breadcrumb, easy breadcrumb render the title in getTitleString to manipulate it, whereas other breadcrumb builder get the page title and pass it to the Link object which encode correctly.
But as easy breadcrumb manages logic around the link title, impossible to do the same thing.
I will upload a patch but I don't know if other parts of easy breadcrumb are concerned.
Comments
Comment #2
qubel commentedHere is the patch.
Thanks for the review.
Also I made this resolution with my mentor https://www.drupal.org/u/grimreaper.
Comment #3
jacob_weber commentedThis works for me if the path is not nested within the breadcrumbs and a link. If the path is a link there needs to be another decode applied to allow for that as well.
I've attached a patch (although I'm not sure I created it correctly).
Comment #4
alisonHi! The patch works! -- but, I think it's a dupe of #2990464: Breadcrumb markup should allow some tags such as italics or strong (and its predecessor, #2979389: Titles in breadcrumbs are 'double-escaped').
#2990464 is still open, though, maybe what you've got could help over there?
Comment #5
greg boggsThat issue is still open, but that's actually a different request than this one.
Comment #6
stephane aimar commentedHi,
We was using this patch and we need it with the latest 8.1.13 version.
Now a simple page output a well formed output there is no more bug with the example given by qubel.
The titleResolver now output a string with "&" and no more HTML.
But when you put a "&" in a title for a view configured as a page the breadcumb output an "&".
The titleResolver return a MarkupInterface instance for a view and "&" are HTML encoded in the protected string .
Here is a new patch for the last 8.1.13 version and the same for the 8.x.1.x-dev.
Comment #7
grimreaperComment #8
stephane aimar commentedComment #9
pooja.nanwal commentedAble to reproduce issue. After applying patch (easy_breadcrumb-8.x.1.x-dev-html_character_decoded-3056018.patch) , it worked fine.
Screenshot attached( Before Patch.png, After Patch #6.png ).
Ready for RTBC.
Comment #10
petr illekI can confirm the patch in #6 is working ok when using with Views Title.
Marking as RTBC.
Comment #11
maico de jongWasn't working for me in some cases, taxonomy term names in breadcrumb for example.
Attached patch will fix those too.
Comment #12
neslee canil pintoHi i am not able to reproduce this bug, i am getting Proper result, if i add
Test & debughas title for a node, and when i visit that page i get Proper result which isHome -> Test & debugComment #13
jshimota01 commentedI had reported separately a similar HTML special char problem -the & character showing as text (& amp;)
The issue I opened was closed as it seems to be related to this issue. I'm not convinced it's the same problem but what do I know!
In my case, the patch above FIXED the string as displayed in the node name part of the title - but reference to a parent still shows the offensive string.
Attached is a screen shot of my test after applying #11.
In my case - I had documented my settings in issue 3169568. My version of this problem is not the node name but the parent. The link does take you correctly to the parent, but the parent title coming from a View is displaying incorrectly. I also use numerous regex statements (see my issue for screen caps). One suggestion was to override the string in Override Titles section which I also tried as so:
Endorsements & ; Testimonials::Endorsements & Testimonials (<--edited - the special char is getting replaced in my comment so I added a space)
This override didn't have an effect either, so in my case neither the patch nor the override solve the problem. I had a theory that the Override runs before the Regex so that explains that failure. but I'm really surprised by the actually failure itself!
For me, this is NOT a critical issue - I'm just offering info in case it's found useful, tickles the right brain cell on a smart person or whatever. I'm changing character to AND as a workaround. This really is a problem though as I need the character space used because it is a long string and in my responsive design on small screen media it wraps. yes. just those 4 characters! (I solved it by changing the font from 12 to 11 :). I'm running on at the mouth. sorry. thank you!
Comment #14
gsquirrelI had this issue with a view title - tried the patch and seems to work fine for that situation at least.
Comment #15
pushpinderchauhan commentedOne more use case that was failing in my case when a user adds custom breadcrumb using the "Paths to replace with custom breadcrumbs" feature in the admin. Here's the attached path to take care of that section.
Comment #16
jshimota01 commentedIt's beautiful man!!!
sorry- dealing with numerous bugs lately and it's so nice to see one handled!!! Solved me sir - I'm grateful. Image attached. Worked perfect in both parent AND (&?) [pun intended!!!] page links :).
Note to others - in my composer.json I had the .11 patch and just added this patch as a second patch to the module without looking closely. That failed (for obvious reasons!) If you have the previous patch as I did, be sure to remove it first.
Comment #17
jshimota01 commentedComment #18
mikell commentedWorks fine with patch of #15
Comment #20
neslee canil pinto