OrchardCMS / Orchard

Orchard is a free, open source, community-focused Content Management System built on the ASP.NET MVC platform.
https://orchardproject.net
BSD 3-Clause "New" or "Revised" License
2.37k stars 1.12k forks source link

Ambiguity in LocalizedTaxonomyController action names #8785

Closed AndreaPiovanelli closed 1 month ago

AndreaPiovanelli commented 2 months ago

This fixes an ambiguity issue for the GetTaxonomy action of LocalizedTaxonomyController. There was a "new GetTaxonomy" action in AdminLocalizedTaxonomyController too that was ambiguous, failing to properly work. For this reason, the action has been removed from AdminLocalizedTaxonomyController and the admin filter is added via override of the ApplyPreRequest function.

BenedekFarkas commented 2 months ago

Can you provide repro steps to compare before/after?

AndreaPiovanelli commented 2 months ago

Can you provide repro steps to compare before/after?

The issue was easily reproducible when opening the edit page of an item containing a TaxonomyField. The ajax call in TaxonomyFieldList shape (https://github.com/LaserSrl/Orchard/blob/8ed7b67f1fc865e60b1de658b085fb49efb45151/src/Orchard.Web/Modules/Orchard.Taxonomies/Views/EditorTemplates/Fields/TaxonomyFieldList.cshtml#L13) failed, showing the "Loading taxonomy failed" alert message at line 136 of the same file. The error wasn't logged by Orchard, because it's a MVC error, but you can see it in the browser console: Loading taxonomy fail message: image The error displayed was the following: The current request for action 'GetTaxonomy' on controller type 'AdminLocalizedTaxonomyController' is ambiguous between the following action methods:

The current request for action 'GetTaxonomy' on controller type 'AdminLocalizedTaxonomyController' is ambiguous between the following action methods: System.Web.Mvc.ActionResult GetTaxonomy(System.String, System.String, Int32, System.String, System.String) on type Orchard.Taxonomies.Controllers.AdminLocalizedTaxonomyController System.Web.Mvc.ActionResult GetTaxonomy(System.String, System.String, Int32, System.String, System.String) on type Orchard.Taxonomies.Controllers.LocalizedTaxonomyController

I didn't notice this problem before PR #8780 was merged, because of the javascript syntax error blocking the proper execution of the code.

BenedekFarkas commented 2 months ago

@AndreaPiovanelli please check the suggested changes and/or enable edits from maintainers.

AndreaPiovanelli commented 1 month ago

@BenedekFarkas I took some time to test your suggestions in our environment and have now applied the changes you requested to current pr branch. I had to apply the last one separatedly (not via the "commit suggestion" button) because git disabled that button as apparently it was an "outdated suggestion" for it.

BenedekFarkas commented 1 month ago

OK, thanks!