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

qubel created an issue. See original summary.

qubel’s picture

Assigned: qubel » Unassigned
Status: Active » Needs review
StatusFileSize
new1.14 KB

Here is the patch.

Thanks for the review.

Also I made this resolution with my mentor https://www.drupal.org/u/grimreaper.

jacob_weber’s picture

This 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).

alison’s picture

Status: Needs review » Closed (duplicate)
Related issues: +#2990464: Breadcrumb markup should allow some tags such as italics or strong

Hi! 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?

greg boggs’s picture

That issue is still open, but that's actually a different request than this one.

stephane aimar’s picture

Hi,
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.

With node

But when you put a "&" in a title for a view configured as a page the breadcumb output an "&amp".

View title

The titleResolver return a MarkupInterface instance for a view and "&" are HTML encoded in the protected string .

Breadcrumb output

Here is a new patch for the last 8.1.13 version and the same for the 8.x.1.x-dev.

grimreaper’s picture

Status: Closed (duplicate) » Needs review
stephane aimar’s picture

pooja.nanwal’s picture

StatusFileSize
new241.92 KB
new266.09 KB

Able 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.

petr illek’s picture

Status: Needs review » Reviewed & tested by the community

I can confirm the patch in #6 is working ok when using with Views Title.
Marking as RTBC.

maico de jong’s picture

Status: Reviewed & tested by the community » Needs review
StatusFileSize
new1.32 KB
new946 bytes

Wasn't working for me in some cases, taxonomy term names in breadcrumb for example.
Attached patch will fix those too.

neslee canil pinto’s picture

Hi i am not able to reproduce this bug, i am getting Proper result, if i add Test & debug has title for a node, and when i visit that page i get Proper result which is Home -> Test & debug

jshimota01’s picture

Related issues: +#3169568: & in breadcrumb shows as &
StatusFileSize
new165.31 KB

I 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 &amp ; 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!

gsquirrel’s picture

I had this issue with a view title - tried the patch and seems to work fine for that situation at least.

pushpinderchauhan’s picture

StatusFileSize
new1.72 KB

One 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.

jshimota01’s picture

StatusFileSize
new62.25 KB

It'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.

jshimota01’s picture

Status: Needs review » Reviewed & tested by the community
mikell’s picture

Works fine with patch of #15

neslee canil pinto’s picture

Status: Reviewed & tested by the community » Fixed

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.