silverstripe-kickassets icon indicating copy to clipboard operation
silverstripe-kickassets copied to clipboard

Warning: No route matches path and Translatable

Open DrMartinGonzo opened this issue 9 years ago • 8 comments

This is different from issue #17,

I really dont know React but some console logs showed me that _storesConfig2['default'].get('baseRoute') outputs /admin/kickassets/?Locale=fr_FR The ?Locale=fr_FR bit seems to prevent the route match.

if I hardcode the link for baseroute instead of $this->Link() it works.

This part in TranslatableCMSMainExtension.php line 134 is responsible for updating the link

function updateLink(&$link) {
        $locale = $this->owner->Locale ? $this->owner->Locale : Translatable::get_current_locale();
        if($locale) $link = Controller::join_links($link, '?Locale=' . $locale);
}

But I haven't found a way to temporarily disable it or any other acceptable solution, which would be more React related I guess ? Still a learner in all dev related things, sorry for not being more helpful.

DrMartinGonzo avatar Nov 27 '15 18:11 DrMartinGonzo

I too have encountered this issue. A workaround is to strip the query string from baseRoute. To do this change /code/KickAssets.php line 442 to

'baseRoute' => preg_replace('/\?.*/', '', Controller::join_links(Director::baseURL(), $this->Link()))

While this does seem a bit hacky, I'm not sure if there is a better solution.

Perhaps @unclecheese could advise if there is a better solution, if not I will create a PR.

cjsewell avatar Dec 01 '15 02:12 cjsewell

Thank you for your answer, it does feel a bit hacky but I can't think of a situation where that would break things.

DrMartinGonzo avatar Dec 01 '15 10:12 DrMartinGonzo

I'm also having trouble using kickassets from uploadfield. I can see GET http://dev.*****.com/admin/kickassets/folder/NaN?sort=newest 404 (Not Found) in Chrome dev console. I suppose Nan should be folder ID.

Do you also see this behavior ? Just to know if it could also be Translatable related. If not, I'll open another issue.

DrMartinGonzo avatar Dec 01 '15 10:12 DrMartinGonzo

@DrMartinGonzo Sorry about the delay, No I don't have that issue so I don't this its translatable related? @unclecheese What do you think about the workaround, is it work a pull request?

cjsewell avatar Dec 20 '15 21:12 cjsewell

I also had this issue on a local install on Win 7, fix worked. Just concerned that fix will get overwritten in the future

dianavila avatar Feb 03 '16 19:02 dianavila

@DrMartinGonzo Cheers for the patch. I think that will work fine, although parse_url() would be a be a bit more clear. If you can rewrite it using that, it would be ideal, but I'm happy to merge either one in a PR.

unclecheese avatar Feb 03 '16 21:02 unclecheese

@unclecheese Is this more of what you had in mind? https://github.com/guru-digital/silverstripe-kickassets/blob/translation-workaround/code/KickAssets.php#L439

cjsewell avatar Feb 04 '16 03:02 cjsewell

Perfect. If that solves the issue, please submit a PR. Thanks.

unclecheese avatar Feb 04 '16 03:02 unclecheese