Self-host email assets instead of relying on raw.githubusercontent.com#2715
Merged
Conversation
Replace the externally-hosted codebar logo in email templates with the Rails asset pipeline. The logo is now copied from the codebar/assets repo into app/assets/images/email/, a dedicated folder for email-specific assets with a README warning against modifying existing files (digest fingerprints would break previously-sent emails). Also fix the email CSS link in _header.html.haml — it was hardcoded as /assets/email.css which would 404 in production (digest mismatch). Now uses asset_path helper for correct fingerprint path. Set config.action_mailer.asset_host in production (via ASSET_HOST env var for staging override) and development for absolute asset URLs.
mroderick
marked this pull request as ready for review
July 16, 2026 13:42
mroderick
enabled auto-merge
July 16, 2026 15:25
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
The codebar logo in email templates was loaded from
raw.githubusercontent.com/codebar/assets/master/logo/png/website-logo.png. This is brittle:codebar/assetsrepo silently breaks emails with no alertThe email CSS link in
_header.html.hamlwas also hardcoded as/assets/email.css— this would 404 in production where the asset pipeline serves digest-stamped filenames.Changes
app/assets/images/email/— new folder for email-specific assets, with a README warning contributors not to modify existing files (digest fingerprint changes would break previously-sent emails)app/assets/images/email/website-logo.png— copied fromcodebar/assetsrepo (5931 bytes, 370x100 PNG)_body_header.html.haml— replaced raw.githubusercontent.com URL withimage_tag("email/website-logo.png"), removed the TODO_header.html.haml— replaced hardcoded/assets/email.csswithasset_path("email.css")for correct digest resolutionconfig/environments/production.rb— addedconfig.action_mailer.asset_host(readsASSET_HOSTenv var, defaults tohttps://codebar.io)config/environments/development.rb— addedconfig.action_mailer.asset_hostfor local email previewStaging setup
Set
ASSET_HOSTenv var on thecodebar-stagingHeroku app to its URL (e.g.https://codebar-staging.herokuapp.com).Other approaches considered (and rejected)
assets.codebar.io— DNS exists but no origin; unnecessary infra for a single logoapp/assets/email/but would conflict with defaultapp/assets/stylesheets/email.css