This bug was fixed #93854: Allow autocompletion requests to include slashes for Drupal 7, what about a term beginning with dot (.), say: .NET, this immediately brakes the URL adding the current path's last argument to the autocomplete URL.
Any toughs on that?
Thanks!
See: #93854-223: Allow autocompletion requests to include slashes
As far as I can see, this code:
// See if this string begins with dot
searchString = searchString.replace(/^\./, '');
this.searchString = searchString; // This is needs to be done in order to show the matches, otherwise it won't show them
Can be used as well after the line 280 in core/misc/autocomplete.js of Drupal 8.
PD.
Using Drupal 7.14
Comments
Comment #1
steven jones commentedThis will need some simpletests, and an actual patch file for review. See http://drupal.org/contribute/development for a good starting point on the process.
Comment #2
JvE commentedHere's a test.
No solution.
Stripping the dot from the search term in the javascript may prevent an error, but still won't allow you to search on terms starting woth a dot.
It may be worth merging this with the already existing #1559142: Allow autocompletion terms to start with a slash even though the cause of the issue is very different. Test coverage and implementation of actual solutions may otherwise interfere between these two issues.
Comment #4
rjarteta commentedI see, the main issue then is if in the URL the term can pass with the dot and without breaking the URL.
Some scape char like \ ?
Then in the JS add the \ if the term begins with .
That would require some major changes in the autocomplete callback as well.
Should I try that?
Thanks,
Ricardo.
Comment #5
JvE commentedI suspect that it may be the webserver or other config that is disallowing requests for paths or files that start with a dot.
My gut feeling is that we're probably better off if we use some other mechanism for passign the user input to the callback than building a path out of it. A plain querystring comes to mind but this needs more thought.
Comment #6
rjarteta commentedI agree, but we can think of an autocomplete enhancement.
I think it should have something like: autocomplete_path?key=QueryString.
And for the sake of backwards compatibility: autocomplete_path/QueryString?key=QueryString.
And of course the new callbacks can use the QueryString on the path like they used to, or the key in the querystring.
Of course, the breaking of the URL still has to be taken into account.
Comment #7
rjarteta commentedThe team tester found this breaking term: word/.net which also breaks the URL.
I created this two patches for the project running Drupal 7.14.
The revision 35 being the Drupal stable.
What do think about this?
And in the taxonomy module:
Comment #8
rjarteta commentedAttaching a patch, see if it's good enough.
Comment #9
nod_Comment #10
droplet commentedit should use symfony2's request()
It also worth to check why Drupal does not handle leading DOT in path.
Comment #11
JvE commentedDrupal (apache) rejects paths starting with a dot due to this snippet from the .htaccess file in the drupal root:
Comment #12
droplet commentedThanks.
#581706: Protect .git, .hg and .bzr directories in .htaccess
Comment #13
rjarteta commentedIf that gets fixed, the patch here only would be a change in the behavior of the autocomplete, adding a search_string as a parameter, then modules like taxonomy catch the search string as a parameter.
And yes! it should be the symfony2's request(). But didn't know about the Request until @droplet pointed out.
Sorry, don't know Symfony that much. Time to learn new stuff!!
Comment #14
mahipal46 commented#8 is work for me thanks
Comment #15
mahipal46 commented#8: drupal-taxonomy-autocomplete-dot-1661098-8.patch queued for re-testing.
Comment #16.0
(not verified) commentedPHP code was stripping the \ in the code
Comment #16.1
klonos..converted links to issues to their [#xxxxxx] equivalents so they can also indicate issue title and reflect issue status.
Comment #17
droplet commentedD8 is using jQuery UI Autocomplete now
Comment #18
dcam commentedThis issue is a duplicate of #1232134: Autocomplete terms starting with . (period) fails with 403 Forbidden..