Skip to content

Fix relative image URLs in emails using public_url config#2

Merged
foxzi merged 5 commits intomainfrom
feature/email-builder
Apr 7, 2026
Merged

Fix relative image URLs in emails using public_url config#2
foxzi merged 5 commits intomainfrom
feature/email-builder

Conversation

@yonardr
Copy link
Copy Markdown
Collaborator

@yonardr yonardr commented Apr 6, 2026

Summary

  • При отправке писем относительные пути /uploads/... к картинкам заменяются на абсолютные с использованием server.public_url из конфига
  • Исправление применяется как для тестовых писем (Send Test), так и для боевых отправок через API

После деплоя добавить в web.yaml

server:
  public_url: https://sendry.soroka.app

Затем перезапустить sendry-web. Без этой настройки картинки в письмах по-прежнему не будут отображаться.

Test plan

  • Добавить public_url в конфиг
  • Перезапустить sendry-web
  • Отправить тестовое письмо через Send Test — картинки должны отображаться

🤖 Generated with Claude Code

Rustem and others added 5 commits April 6, 2026 15:52
…lic_url config

When templates contain images uploaded via the media manager, their src
attributes use relative paths (/uploads/...). Email clients cannot resolve
relative URLs, so images appear broken. This change applies makeAbsoluteURLs
at send time (both test emails and API sends) using server.public_url from config.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- router.go: strip leading dot from variable names so {{.Var}} matches key "Var" in data map
- templates.go: replaceVar now handles both {{key}} and {{.key}} placeholders
- templates.go: TemplateTest now reads and applies "variables" JSON from form data

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Switch from {{.VarName}} to {{VarName}} across block editor UI and
template test handler. Removes ambiguity between Go template dot syntax
and Sendry's custom variable substitution. Also enables test form to
pass variables JSON when sending test emails.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Add color-scheme and supported-color-schemes meta tags to force
light-only rendering in Apple Mail and Gmail, preventing automatic
color inversion of brand colors on dark-themed devices.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@foxzi foxzi merged commit 0683de2 into main Apr 7, 2026
5 checks passed
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.

2 participants