Fix/improve local ActiveStorage backend usage and handling of WebApp icons #162

Merged
greg merged 10 commits from bugfix/local_web_app_icons into chore/update_dependencies 2024-02-27 16:07:55 +00:00
Showing only changes of commit bd1b177993 - Show all commits

View File

@@ -20,6 +20,8 @@ module AppCatalogManager
@app.save!
# TODO move icon downloads to separate, async job
if icon = metadata.select_icon(sizes: "256x256") ||
icon = metadata.select_icon(sizes: "192x192")
attach_remote_image(:icon, icon)
@@ -49,7 +51,12 @@ module AppCatalogManager
tempfile = Down.download(download_url)
@app.send(attachment_name).attach(key: key, io: tempfile, filename: filename)
rescue Down::NotFound
Rails.logger.warn "Icon download failed: NotFound error for #{download_url}"
msg = "Download of \"#{attachment_name}\" failed: NotFound error for #{download_url}"
Rails.logger.warn(msg)
Sentry.capture_message(msg)
rescue => e
Rails.logger.warn "Saving attachment \"#{attachment_name}\" failed: \"#{e.message}\""
Sentry.capture_exception(e) if Setting.sentry_enabled?
end
end
end