ckan/ckanext-showcase

CSS files assume CKAN is accessed via the domain root (ckan.root_path is empty)

Chealer opened this issue · 1 comments

showcase/read.html and showcase/edit_base.html refer to showcase's CSS file ckanext_showcase.css. For example, read.html has:

{% block styles %}
  {{ super() }}
  <link rel="stylesheet" href="{{ g.site_url }}/ckanext_showcase.css" />
{% endblock %}

This unfortunately only works for CKAN instances accessible using the root of their domain. In those for which a path is needed (for example, "https://www.donneesquebec.ca/recherche/"), the href attribute is incomplete, causing the browser's request for showcase's CSS to yield an HTTP 404 error. For example, in the site above, the browser would request "https://www.donneesquebec.ca/ckanext_showcase.css", when it should request "https://www.donneesquebec.ca/recherche/ckanext_showcase.css".


The issue in CKAN's core which underlies this issue is tracked in ckan/ckan#5425. This issue can be avoided considering ckan.root_path.


The same issue affects ckeditor-content-style.css, and I would suggest those who know showcase to check that the few other usages of site_url it does are correct.

These issues are quite common when the developer doesn't remember that there might be other configurations than the one where ckan is in root path. Extensions should generate URLs themselves, it should be left to ckan. I'll create a PR for it.