URL format errors in lightbox on Calendars events

Anyone else having intermittent issues with the URL that’s created for an event on a calendar? Sometimes, when I click the event, the lightbox responds with a ‘Cannot load’ message and the dev console shows a 404. When I look at the URL for it, there’s 2 forward slashes before the event id number (60 in this case) like so “…/ccm/calendar/view_event/2520//60” instead of only 1. It doesn’t happen all the time so perhaps there’s some sort of interaction between other components/variable. I have added some JS code in the view.php to check for the double slash and remove it if it exists and all is working. Is this something local to my install or have others stumbled into it as well.

The concrete/blocks/calendar/view.php file is using a rather strange way to build the lightbox URL.

You can try to replace the line

element.attr('href', '<?=rtrim(\Concrete\Core\Support\Facade\Url::route(['/view_event', 'calendar'], $bID))?>/' + event.id).magnificPopup({

with

element.attr('href', CCM_DISPATCHER_FILENAME + '/ccm/calendar/view_event/<?= $bID ?>/' + event.id).magnificPopup({

If you can confirm that it works, I can submit a pull request so that next ConcreteCMS versions won’t be affected by this bug.

1 Like

Thx for this. I’ll remove my ‘sanitizing’ code and replace it with your suggestion and let you know what I see.

It works but my issue was intermittent so let me play with it a while to see what happens.

I can’t get the problem to repeat itself. Feel free to submit your code if you think it’s cleaner.