Store web app icons with proper folder paths

This commit is contained in:
Râu Cao 2023-10-23 16:08:23 +02:00
parent 0a69603643
commit bec827acb1
Signed by: raucao
GPG Key ID: 15E65F399D084BA9

View File

@ -35,10 +35,11 @@ module AppCatalogManager
def attach_remote_image(attachment_name, icon)
download_url = "#{@app.url}/#{icon["src"].gsub(/^\//,'')}"
filename = "web_apps/#{@app.id}/icons/#{attachment_name}.png"
filename = "#{attachment_name}.png"
key = "web_apps/#{@app.id}/icons/#{attachment_name}.png"
tempfile = Down.download(download_url)
@app.send(attachment_name).attach(io: tempfile, filename: filename)
@app.send(attachment_name).attach(key: key, io: tempfile, filename: filename)
end
end
end