CleanUrl & Collecting module incompatibility

I have a contribution form on a site that’s using the CleanUrl module. When submitting the contribution form, the submission fails and I get this error :

error-controller-not-found

The contribution form works great without the CleanUrl module.

Wondering whether to edit Collecting or CleanUrl. I submitted an issue on CleanUrl’s gitlab repo too, so if I learn anything there then I’ll update here.

Omeka S 3.1.0
Collecting 3.17.3.3
CleanUrl 1.8.0

This is what I did, which works for my purposes because I only have one contribution form.

Added a temporary redirect in htaccess for the Collecting module’s success view:

Redirect 302 /collecting/1/success https://example.com/s/archive/collecting/1/success

Edited the submission form’s action attribute so that it doesn’t use CleanUrl’s url structure. To edit the action attribute, I edited Collecting/src/Api/Representation/CollectingFormRepresentation.php

In the getForm() function, I replaced this:

$form->setAttribute('action', $url('site/collecting', [
            'form-id' => $this->id(),
            'action' => 'submit',
        ], true));

with this:

$form->setAttribute('action', '/s/archive/collecting/' . $this->id() . '/submit');

This solution works for me, but it is an edit to the module’s core file, so I’ll have to remember to edit this after Collecting module updates.

If anyone has a cleaner solution, I’m interested!

2 Likes

Thanks for the hack. This is a complex issue, because CleanUrl should manage all routes of all modules, so it may be fixed later.

This is kind of off-topic but not too much: there’s the same problem when using the Guest module, where one has the /login, /logout, /register routes. The Guest module throw errors when Clean URL is active and is skipping the s/my-site bit.

This topic was automatically closed 250 days after the last reply. New replies are no longer allowed.