Reproduce:

  1. Create a term with an ampersand (&).
  2. Create a panel (for example) such that this term name is sent to a view as an argument.
  3. Create a view that receives the term name as a Contextual Filter, provides a Validation criteria of type Taxonomy term, and uses Filter type Term name converted to term id.

The terms with an ampersand will not be properly converted, thus resulting in an empty view.

Files: 
CommentFileSizeAuthor
#13 views-ampersand_in_contextual_filter-1768738-12.patch941 byteslmeurs
Test request sent.
[ View ]
#6 views-term_arg_decode_entities-1768738-6.patch726 bytesjeffschuler
PASSED: [[SimpleTest]]: [MySQL] 1,555 pass(es).
[ View ]
#2 term-decode.patch545 byteseckroth
FAILED: [[SimpleTest]]: [MySQL] Unable to apply patch term-decode_0.patch. Unable to apply patch. See the log in the details link for more information.
[ View ]
term-decode.patch515 byteseckroth
FAILED: [[SimpleTest]]: [MySQL] Unable to apply patch term-decode.patch. Unable to apply patch. See the log in the details link for more information.
[ View ]

Comments

Status:Needs review» Needs work

The last submitted patch, term-decode.patch, failed testing.

eckroth’s picture

StatusFileSize
new545 bytes
FAILED: [[SimpleTest]]: [MySQL] Unable to apply patch term-decode_0.patch. Unable to apply patch. See the log in the details link for more information.
[ View ]
eckroth’s picture

Status:Needs work» Needs review

Status:Needs review» Needs work

The last submitted patch, term-decode.patch, failed testing.

eckroth’s picture

I'll read up on how to format a patch later... it's a one-liner so it should be easily understood even without automated testing.

jeffschuler’s picture

Version:7.x-3.5» 7.x-3.x-dev
Priority:Major» Normal
Status:Needs work» Needs review
StatusFileSize
new726 bytes
PASSED: [[SimpleTest]]: [MySQL] 1,555 pass(es).
[ View ]

Looks like your patch is missing another newline at the end.
I could apply it using the patch utility, but not with git apply.
Rerolled

freak1321’s picture

omerida’s picture

this patch fixed this issue for me

Geijutsuka’s picture

Is this issue related to #672606: Hyphens and forward slashes (-/) break Views contextual filters? It would be great if this patch killed two issues.

Edit: sorry, didn't mean to reference the same issue...

sgammon’s picture

Just curious, will this patch be in the next Views release?

meeli’s picture

If you select the option to convert spaces in term names to hyphens this patch is no longer effective. Investigating this now, I'll post a patch if I can figure it out.

jyraya’s picture

Issue summary:View changes

Hello meeli,

Selecting option "convert spaces in term names to hyphens" did not work for me when I pass the argument through a views pane context and the passed name come from a term reference field value. The ampersand contained in the term name is still "&".

The patch supplied by jeffschuler worked for me (thanks for it!).

I think that the decode_entities should also applied when the the option "convert spaces in term names to hyphens" because of other special characters that could be to convert like "é", "ç", "ô".
Do you see a case where that could not work by applying the decode_entities in this case?

lmeurs’s picture

StatusFileSize
new941 bytes
Test request sent.
[ View ]

Thanks for the patch!

@jyraya, @meeli: I cannot find the option Convert spaces in term names to hyphens, is this in Panels or Views?

I did find the Transform dashes in URL to spaces in term name filter values option in the Views' contextual filter dialog window. The patch from #6 does not take this option into account, it only decodes entities if the transform option has not been set.

Attached patch decodes entities in both cases, please review and set RTBC if all is ok!