mastervanleeuwen / J-TrackGallery

GPS Track Gallery component for Joomla
https://mastervanleeuwen.github.io/J-TrackGallery/
6 stars 0 forks source link

Bug in router for track delete #60

Closed jvevfvf closed 11 months ago

jvevfvf commented 12 months ago

jtgBuildRoute Need to add id to segment i.e if (($view == 'track' || $view == 'cat' || $task='delete') && isset($query['id'])) { $segments[] = $query['id']; unset($query['id']); } so that in parseRoute we don't drop into the count==2 section, but fall into the else which then calls ParseRouteFile

jvevfvf commented 12 months ago

This is for the latest version on joomla 4

mastervanleeuwen commented 11 months ago

Thanks for the report.

I am happy to fix this, but would like to understand a bit better when this problem is triggered. Have you encountered an error in navigating a web site? In which case do we end up here?

jvevfvf commented 11 months ago

When trying to delete a track. (task=delete) Sorry, forgot to make that clear. Cheers Jeff

jvevfvf commented 11 months ago

This was the route: /component/jtg/track/delete/270 So three segments. (missed a double == above too, and needed to define $task doh). Without the code, the route is: /component/jtg/track/delete?id=272 which just shows the route, and doesn't delete

jvevfvf commented 11 months ago

This is my code:

$view = '';
if (isset($query['view']))
{
    $view = $query['view'];
    $segments[] = $view;
    unset($query['view']);
}

if (isset($query['layout']))
{
    $segments[] = $query['layout'];
    unset($query['layout']);
}

if (isset($query['controller']))
{
    $segments[] = $query['controller'];
    unset($query['controller']);
}

$task='';
if (isset($query['task']))
{
    $task=$query['task'];
    $segments[] = $query['task'];
    unset($query['task']);
}

if (($view == 'track' || $view == 'cat' || $task=='delete') && isset($query['id']))
{
    $segments[] = $query['id'];
    unset($query['id']);
}
mastervanleeuwen commented 11 months ago

Thanks for the additional info. The new pre-release:

https://github.com/mastervanleeuwen/J-TrackGallery/releases/tag/0.9.34-rc34

has this fix included.

jvevfvf commented 11 months ago

Thanks. It looks good now. Cheers Jeff