Allow autocompletion requests to include slashes

Created on 9 November 2006, about 18 years ago
Updated 16 May 2023, over 1 year ago

Problem/Motivation

Taxonomy terms may contain slashes, but the autocomplete widget used to populate a taxonomy term list does not allow slashes.

Proposed resolution

The latest patch in #207 implements the following solution:

  • Changes misc/javascript.js to enable autocomplete terms to contain slashes.

  • Tweaks the autocomplete menu callback to include all arguments passed by the menu system.

  • Adds automated test coverage for this functionality.

Remaining tasks

  • The approach needs to be reviewed, manually tested and then committed to D7 and D6.

Steps to test this patch

  1. Create an article and enter a tag containing a slash. Save the article and verify the term is created correctly.
  2. Create a second article and try to use the autocomplete to add the term you added to the first article. Save the article and check at admin/structure/taxonomy/tags/add to make sure it used the same tag rather than creating a new one.
  3. Add some other terms containing slashes to the tags vocabulary at admin/structure/taxonomy/tags/add. Try some different patterns: 11/1/2011, 11/2/2011, import/export, "Term name containing a comma, plus / slashes / too.", This term's got / slashes and apostrophes. Etc.
  4. Test autocompletion and saving of these terms as well.

User interface changes

None.

API changes

  • None.

Original report by moonray

Using a slash in an autocomplete field breaks functionality.

example url:
http://localhost/drupal/recipe/ingredient/autocomplete/looking%20for%201...

error:
Not Found

The requested URL /drupal/recipe/ingredient/autocomplete/looking for 1/2 a loaf was not found on this server.
Apache/2.0.55 (Ubuntu) PHP/5.1.6 Server at localhost Port 80

The reason (I believe) is that it interprets the escaped slash as a regular slash, and thus a path delimiter. This error does not occur when you don't use clean urls.

Is there another way to escape forward slashes than %2F, so they don't get interpreted as a path delimiter?

If you give me that answer I can write a patch to submit. :-)

πŸ› Bug report
Status

Fixed

Version

7.0 ⚰️

Component
FormΒ  β†’

Last updated about 9 hours ago

Created by

πŸ‡ΊπŸ‡ΈUnited States moonray

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

Production build 0.71.5 2024