Hello,

Bug I encountered today, when I changed the settings of a link field. It was previously set to default (no target), and many nodes where saved with this value.
Then I changed the setting to "Allow user to choose".
Now, all the previously saved nodes see their links getting target="user". This is because of the way the field attributes are merged to the link attributes. To fix the problem manually, I need to save all the nodes impacted by the field change.

The patch attached provides a better way to "sanitize" the target attribute.

Regards,

David

Comments

David Stosik’s picture

Up ?

eric_a’s picture

Version: 6.x-2.x-dev » 7.x-1.x-dev
Priority: Normal » Major
Status: Needs review » Needs work

Broken in 7.x as well so I'm guessing it's going to be fixed in 7.x first and then backported.
Also this looks pretty major to me.

I'll try to come up with a proper 7.x-patch soon, but here's a snippet showing David Stosik's basic idea (getting rid of the "user" target attribute value after merging) for 7.x:

  elseif (isset($item['attributes']['target']) && $item['attributes']['target'] != '_blank') {
    unset($item['attributes']['target']);
  }
jcfiala’s picture

Status: Needs work » Fixed

Okay - I think this is fixed for the 7.x-1.x branch. I'd like it if either of you could have a look at the dev roll (once this fix makes it in) and have a look and see if it works for you.

Assuming it's good, we'll move on and set up a fix for 6.x.

Status: Fixed » Closed (fixed)

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

danmed’s picture

Version: 7.x-1.x-dev » 6.x-2.10
Status: Closed (fixed) » Patch (to be ported)

Hello,
I am having this problem in Drupal 6 now. When is the 6.x fix due for?

This is a very annoying issue, and breaks my site navigation.
Thank you for your answer.

David Stosik’s picture

Hello,

I think you can try to use the patch I uploaded on first post, as it was designed for 6.x-2.10.

David

jhodgdon’s picture

Status: Patch (to be ported) » Reviewed & tested by the community

I just tested the patch in the original post on this issue, in version 6.x-2.10, and it works perfectly. It applies with some "fuzz", but should be OK.

kalis1’s picture

StatusFileSize
new1.06 KB

Here is a slightly modified patch applying for the 6.x-2.10 version (no code changes, only lines number)
Thank you @David Stosik !

webservant316’s picture

is this committed to 6.x-2.dev?

jcfiala’s picture

Issue summary: View changes
Status: Reviewed & tested by the community » Fixed

Couldn't use the latest patch, but I copied it more or less into the code and committed and pushed to branch.

Please test the dev release sometime soon.

Status: Fixed » Closed (fixed)

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