Minor: Gazette SP Page Builder addons build asset URLs with a double slash (`https://example.com//templates/...`) - Forum | JoomShaper
Staff replied Templates Joomla 5 v2.0.5

Minor: Gazette SP Page Builder addons build asset URLs with a double slash (`https://example.com//templates/...`)

Asked by HalTurner 13 hours ago Last activity 12 hours ago

Environment

  • Template: Gazette 2.0.5 (shaper_gazette), Helix Ultimate 2.2.10
  • SP Page Builder 6.10.0 (Pro), Joomla 5.4.10, PHP 8.3

The problem

Three of the template's SP Page Builder addons build their script and stylesheet URLs like this:

$base_path = Uri::base() . '/templates/' . $app->getTemplate() . '/js/';

Uri::base() (without the true argument) returns the full site URL with a trailing slash, e.g. https://example.com/. Adding '/templates/' produces https://example.com//templates/shaper_gazette/js/owl.carousel.min.js.

Where it occurs in the 2.0.5 package:

  • sppagebuilder/addons/articles_slider/site.php: scripts() and stylesheets()
  • sppagebuilder/addons/articles/site.php: the scripts() path for js/
  • sppagebuilder/addons/thumb_gallery/site.php: scripts() and the flexslider.css stylesheet

Effects:

  • The files still load, because web servers merge the slashes. But every URL relative to those files inherits the // too. For example, the Owl Carousel CSS image becomes //templates/shaper_gazette/css/owl.video.play.png in our access logs.
  • Caches and CDNs treat //templates/... and /templates/... as different URLs. The same file can be cached twice, and path-based rules (cache behaviours, WAF or redirect rules) written for /templates/* don't match the double-slash form.

Suggested fix

Use the path-only base, which has no trailing slash:

$base_path = Uri::base(true) . '/templates/' . $app->getTemplate() . '/js/';

Apply the same change to each listed line. Alternatively, keep Uri::base() and drop the leading slash: Uri::base() . 'templates/' . …. Either produces a single slash and works for sites installed in a subfolder.

Impact

  • Every Gazette site using these addons serves its addon assets from double-slash URLs.
  • The fix is a few one-line changes, with no behaviour change apart from the corrected URLs.
    joomshaper $

1 reply

Anne Staff

Hi HalTurner,

Thank you for providing such a detailed report and clearly outlining the issue, its potential impact, and the proposed solution. We appreciate the time and effort you’ve taken to investigate this and identify the affected addons.

We’ll share your findings with our development team for review and consideration in a future Gazette update.

Thank you again for helping us improve the quality and reliability of our products!

Log in to reply.