Email Images broken src path, missing domain

All images in emails (invites, confirmation, transactions, etc) are built with a broken path. All lack the domain name.

Sharetribe Version:

719e5fa

Environment:

Ubuntu 20.04
Node v10.15.3
NPM 6.4.1

Server mode:

Production

Description:

I’m getting paths like /system/wide_logos/1/header/logo-01.png?1593402420 in the src. Naturally, these images are broken since there’s no domain.

There’s a thread about this exact problem on the community forum.

This solution is dated (three years old), so I’m not sure if the _communitylisting-update-v2.html.haml existed at that time. I am using the new layouts, so that’s one place where I’ll likely be hardcoding my domain. The problems I have with this approach are that there are many diverse areas in which I’ll need to add a domain and that it’s clearly not intended to be this way. I’m hoping I’m missing something obvious.

Steps To Reproduce:

New install of ShareTribe
:local asset configuration
asset_host: mydomain.com (blank also fails to produce image paths)
Successful smtp and sendmail email set-ups (emails are sent and received without errors)

Additional information

I attempted manually adding my domain to the domains and community tables of the database. It corrected some links which were pointing toward the default subdomain installation but did not add the domain to file paths.

I looked at some of these email .yml’s, finding that there’s no special treatment to add the domain name. I’m not deeply familiar with Ruby on Rails, but it doesn’t seem like img_tag() has any post-processing for the src that adds the domain name. The img_tag for the logo in the email headers, for example, looks like this in app/views/email_design/email.html.haml :
= image_tag('logos/full/default.png', alt: community.full_name(I18n.locale), style: 'margin: 0 auto;')

I can understand how these paths are adequate for local assets, but how does this work for remote assets or emailed images? Since I’m the first to have this problem here, there’s clearly something I’m missing.

My hack around this was to append the domain to the following files:
app\views\layouts\email-v2.html.haml \app\views\community_mailer\_communitylisting-update-v2.html.haml

I’m only touching the new layout emails, since I’m using those, and the latter file has two image_tag lines to edit. I did in fact look through every email file (for v2) and these were the only ones with images.

What I did to add the domains dynamically was prepend a bit any image_tag src. This is how each image_tag src field looked when I was done:
"https://#{@url_params[:host]}#{PREEXISTING IMG SRC}"

This worked, with images displaying properly in emails. I can’t shake the feeling I’ve done something naughty, but I suppose I’ll deal with that when I update.

I removed my hack and set the following in config.defaults.yml:

asset_host: mydomainname.com
asset_host: mydomainname.com