Comments

int’s picture

put View in the autocomplete Project textbox.

gábor hojtsy’s picture

I don't think its the number of results. If you type in "V", "Vi", "Vie" or "Views, those are all fine. if you type in "View", that is a 404. This looks like a menu handling bug to me somehow.

tobiasb’s picture

Status: Active » Needs review
StatusFileSize
new2.06 KB

right. try it with "export" , "warnings".

gábor hojtsy’s picture

Uhm, should not /autocomplete be unique enough as a path suffix to avoid such issues?

gábor hojtsy’s picture

Title: Bug in autocomplete » Autocomplete leads to 404 for "view"

@tobiasb: what do you think?

tobiasb’s picture

No. perhaps there are other projects, which use /autocomplete. so its better to use somethings in the path, which is unique for this project eg l10n_server/autocomplete.

gábor hojtsy’s picture

Erm, that is why we already use 'translate/projects/autocomplete', aren't we?

tobiasb’s picture

Yes, but we use this 'translate/projects/[module]' for (project)pages http://localize.drupal.org/translate/projects/views.
We need a path which is in the drupal-module-world unique :D. And I believe l10n_server/autocomplete is unique in drupal-module-world.

gábor hojtsy’s picture

@tobiasb: look, the project is "translate/projects/views", while the autocomplete is "translate/projects/autocomplete/views"; this would admittedly clash with a project named autocomplete, but not with a project named views. We could make it /translate/project-autocomplete or somesuch, but I'm not clear on why would this fix the issue, when we already have a unique path do we?

tobiasb’s picture

StatusFileSize
new2.2 KB

I mean with unique not unique on l.d.o -> unique in the database(menu_...).

gábor hojtsy’s picture

Why is the current one not unique in the database / hook_menu / menu_* tables?

tobiasb’s picture

StatusFileSize
new3.62 KB

perhaps a module use also /autocomplete or want use /autocomplete. And then there is a conflict. but with translate/project-autocomplete it is all ok (99% :D).

*add 2 missing paths

gábor hojtsy’s picture

StatusFileSize
new52.62 KB
new45.74 KB
new60.44 KB

I'd like to understand the reason for the failure. I'm not confident in running around and modifying stuff without understanding why it fails. We know it generally works for almost arbitrary input.

It works if I enter "vie":

It works if I enter "views":

It does not work (throws 404 error if you enter "view" exactly):

Because autocomplete works with path segments, this means:

  • translate/projects/autocomplete/*whetever* -- generally works
  • translate/projects/autocomplete/vie -- specifically works
  • translate/projects/autocomplete/views -- specifically works
  • translate/projects/autocomplete/view -- gives a 404

First question is why and then we can do a fix where we know we actually fix it.

tobiasb’s picture

there are menu items

...
$items['translate/projects/%l10n_community_project/view'] = array(
    'title' => 'Overview',
    'access arguments' => array('access localization community'),
    'type' => MENU_DEFAULT_LOCAL_TASK,
    'weight' => -10,
  );
  $items['translate/projects/%l10n_community_project/export'] = array(
    'title' => 'Export template',
    'page callback' => 'l10n_community_export_page',
    'page arguments' => array(2),
    'access callback' => 'user_access',
    'access arguments' => array('export gettext templates and translations'),
    'file' => 'export.inc',
    'type' => MENU_LOCAL_TASK,
    'weight' => 0,
  );
...
gábor hojtsy’s picture

Status: Needs review » Fixed

Ok, by studying the menu system pattern matching, I see better. I've added one more comment line with this patch and committed: http://drupal.org/cvs?commit=319510

Thanks!

gábor hojtsy’s picture

Also deployed to l.d.o.

Status: Fixed » Closed (fixed)

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