Quantcast
Viewing all articles
Browse latest Browse all 295826

Autocomplete function fails when index.html exist - After upgrading to Drupal 7.39 and chaos tools 1.8

Because form autocomplete temporarily disables clean URLs, this unexpected behavior can cause sites to lose tagging and author autocompletion capabilities if they rely on clean URLs for the autocomplete path to work, such as sites that have an index.html file or that redirect '/' from https to http. Ensuring that index.php is part of the explicit path in this case resolves these issues.

Background

Autocomplete fields throw the follow error:
An AJAX HTTP error occurred.
HTTP Result Code: 200
Debugging information follows.
Path: http://website/?q=eng/taxonomy/autocomplete/...

Autocomplete was working perfectly before upgrading to Drupal core 7.39 and chaos tools 1.8.

After some debugging the error is caused by the path set:
http://website/?q=eng/taxonomy/autocomplete/
This works if index.html doesn't exist, as it would be read by index.php automatically (even when a 301 http status message would be throw and then a redirect to http://website/eng/taxonomy/autocomplete/.. ).

To make it work with the index.html present on the site, I had to remove the '?q=' from the path.
This could be done updating the variable db.uri in misc/autocomplete.js (line 300).
But I opted to do it before the javascript on the includes/form.inc (line 4013), simply added $attributes['value'] = str_replace("?q=", "", $attributes['value']);
This is a temporal fix until the change from the Drupal core affecting the $variables['element'] ['#autocomplete_input']['#url_value'] is tracked down.

UPDATE
After tracking down the path the culprit is the function form_process_autocomplete, as this function is forcing to use non-clean urls. Return a non clean url when index.html exist causes the issue.
A lot of sites use index.html as splash page, and less frequent but there are sites that have other pages at the same level of the Drupal install. so the server index is not necessarily index.php. The server DirectoryIndex can be set to any type of document, (not only index.php or index.html - more info refer to: https://httpd.apache.org/docs/2.4/mod/mod_dir.html ).

The solution is to use index.php in the autocomplete path, it stills working using non-clean urls and it won't matter the server DirectoryIndex option set.


Viewing all articles
Browse latest Browse all 295826

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>