Skip to content

fixed setting SiteLogoPath to a missing asset causing server errors#2035

Merged
Oaphi merged 3 commits intodevelopfrom
0valt/2034/missing-community-icon-fix
Apr 4, 2026
Merged

fixed setting SiteLogoPath to a missing asset causing server errors#2035
Oaphi merged 3 commits intodevelopfrom
0valt/2034/missing-community-icon-fix

Conversation

@Oaphi
Copy link
Copy Markdown
Member

@Oaphi Oaphi commented Apr 1, 2026

closes #2034

To reproduce on develop, set the SiteLogoPath site setting to a path starting with /assets/ and pointing to a non-existent asset (any gibberish should be fine). Observe a server error upon visiting, for example, <your origin here>/ca/posts/random.png (will attempt to generate a community ad for a random post). With the PR applied doing the latter should result in a valid image response with the community name instead of the logo.

Example community ad with a valid logo path:
2026-04-01_07-33

And the same ad with an invalid logo path:
2026-04-01_07-35

@Oaphi
Copy link
Copy Markdown
Member Author

Oaphi commented Apr 1, 2026

Lacks tests and needs #2004 to be merged for the TypeScript check to be fixed, so I am keeping it as a draft for the time being

@codecov
Copy link
Copy Markdown

codecov bot commented Apr 1, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 80.93%. Comparing base (7b6dfd1) to head (6f7f84c).
⚠️ Report is 4 commits behind head on develop.

Additional details and impacted files
Components Coverage Δ
controllers 76.18% <ø> (ø)
helpers 85.37% <100.00%> (+0.28%) ⬆️
jobs 66.88% <ø> (ø)
models 93.04% <ø> (ø)
tasks 61.11% <ø> (ø)

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@Oaphi Oaphi force-pushed the 0valt/2034/missing-community-icon-fix branch from 45ad623 to 6f7f84c Compare April 2, 2026 01:19
@Oaphi Oaphi marked this pull request as ready for review April 2, 2026 01:20
@Oaphi Oaphi requested review from a team, ArtOfCode- and cellio April 2, 2026 01:20
@cellio
Copy link
Copy Markdown
Member

cellio commented Apr 3, 2026

I reproduced the error on develop, switched to this branch and got the behavior described -- and then switched the logo back to what it had been, but I still get "dev community" instead of the logo in the ad. Does that happen for you too?

@Oaphi
Copy link
Copy Markdown
Member Author

Oaphi commented Apr 3, 2026

and then switched the logo back to what it had been, but I still get "dev community" instead of the logo in the ad

Have you cleared the cache with Rails.cache.clear afterwards?

@cellio
Copy link
Copy Markdown
Member

cellio commented Apr 3, 2026

Have you cleared the cache with Rails.cache.clear afterwards?

Ah. No I hadn't realized it was cached, and yes that fixed the issue.

Copy link
Copy Markdown
Member

@cellio cellio left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tested and LGTM. Someone more fluent in magick and our caching should review the code.

@Oaphi
Copy link
Copy Markdown
Member Author

Oaphi commented Apr 3, 2026

Ah. No I hadn't realized it was cached, and yes that fixed the issue.

Yea, ads are cached the moment they are created, so you have to reset either the whole cache or the corresponding key every time you change a dependency such as a site setting (we should probably add some plumbing to do expire the cache automatically in such cases)

@cellio
Copy link
Copy Markdown
Member

cellio commented Apr 3, 2026

(we should probably add some plumbing to do expire the cache automatically in such cases)

I would expect setting a new value to flush the cache entry, yeah. That's something we should look into, separately.

@Oaphi Oaphi merged commit d9cb859 into develop Apr 4, 2026
13 checks passed
@Oaphi Oaphi deleted the 0valt/2034/missing-community-icon-fix branch April 4, 2026 02:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Community advertisements should gracefully handle incorrect SiteLogoPath

3 participants