silverstripe-kickassets
silverstripe-kickassets copied to clipboard
Warning: No route matches path and Translatable
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.
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.
Thank you for your answer, it does feel a bit hacky but I can't think of a situation where that would break things.
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 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?
I also had this issue on a local install on Win 7, fix worked. Just concerned that fix will get overwritten in the future
@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 Is this more of what you had in mind? https://github.com/guru-digital/silverstripe-kickassets/blob/translation-workaround/code/KickAssets.php#L439
Perfect. If that solves the issue, please submit a PR. Thanks.