Fail gracefully when remote icon is 404
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
Râu Cao 2024-01-29 14:54:18 +02:00
parent b0b56fcf92
commit f8da034e66
Signed by: raucao
GPG Key ID: 37036C356E56CC51

View File

@ -45,8 +45,12 @@ module AppCatalogManager
filename = "#{attachment_name}.png"
key = "web_apps/#{@app.id}/icons/#{attachment_name}.png"
begin
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}"
end
end
end
end