Ltr stylesheets are missing

AI-generated summary

A discussion about missing LTR stylesheets in Discourse forums. The issue arises when viewing the source of a non-CDN served forum, where the stylesheet link tag points to a non-existent /stylesheets/ directory. Qasem_h suggested checking the stylesheets directory in the Discourse codebase, but simon believes this isn’t the correct location for production stylesheets.

sam pointed out that stylesheets are cached in the tmp directory and the stylesheet_cache table. However, simon found that the RTL stylesheet was not being loaded, despite being present in tmp/stylesheet-cache. sam suggested upgrading to the latest version and running assets:precompile, but simon confirmed that the issue persists even with the latest version.

sam was able to reproduce the issue and suspected it was due to underscore-based splitting in the controller. simon attempted to modify the code to fix the issue, and sam later confirmed that the fix was to modify the controller to split the stylesheet name using rpartition instead of split. A fix was pushed to the Discourse repository by sam.

When I view the source on a Discourse forum that is not being served by a CDN, the stylesheet link tag points to a /stylesheets/ directory. Where is that directory?

1개의 좋아요

look this :

globs = ["#{Rails.root}/app/assets/stylesheets/**/*.*css"]
1개의 좋아요

I don’t think that’t it for the production stylesheets.

1개의 좋아요

its in tmp directory and stylesheet_cache table

I’m asking because it’s not finding the _rtl stylesheet, but the RTL stylsheet is in tmp/stylesheet-cache/

1개의 좋아요

what version are you running, had some bugs I fixed yesterday.

upgrade to latest and be sure that assets:precompile runs.

The latest version on the master branch. assets:precompile runs. The ltr and rtl versions of the stylesheets are all present in tmp/stylesheet-cache.

With a LTR language the stylesheet link tag is outputting this:
<link href="/stylesheets/desktop_0eb6bcb9ae52a6f7bcd2c532c6f8f020d1b7a01b.css?__ws=forum.bookswithwings.org" media="all" rel="stylesheet">

This is finding the stylesheet.

With a RTL language the stylsheet link is:
<link href="/stylesheets/desktop_rtl_0eb6bcb9ae52a6f7bcd2c532c6f8f020d1b7a01b.css?__ws=forum.bookswithwings.org" media="all" rel="stylesheet">

This is returning a status of 404. But the rtl file is present in tmp/stylesheet-cache

I also tried setting up a new installation of Discourse and got the same results.

When I apply the changes made in this PR to an older version of Discourse (when you were still accessing the stylesheets in the uploads/stylesheet-cache directory, everything works as expected.

1개의 좋아요

confirmed, repro here, will get it sorted

1개의 좋아요

I bet it’s the underscore based splitting in the controller

1개의 좋아요

I tried removing the underscore before ‘rtl’ and it still couldn’t find the rtl stylesheets, but I might have missed something when I did it.

Yeah, this seems to fix the problem.

target,digest = params[:name].split(“_”)

target = params[:name].rpartition("_").first
digest = params[:name].rpartition("_").last
3개의 좋아요

Pushed a fix

https://github.com/discourse/discourse/commit/bcaed90744bf470504b883010f28c9f59bd33505

4개의 좋아요