Add timestamp to icon filenames
There can be race condition when a background job is supposed to delete an icon while there is a new one being attached. Also, this encodes the date/time when the icon has been added, for inspection and convenience.
This commit is contained in:
parent
a7410058fa
commit
3f110995a4
@ -42,8 +42,8 @@ module AppCatalogManager
|
|||||||
else
|
else
|
||||||
download_url = "#{@app.url}/#{icon["src"].gsub(/^\//,'')}"
|
download_url = "#{@app.url}/#{icon["src"].gsub(/^\//,'')}"
|
||||||
end
|
end
|
||||||
filename = "#{attachment_name}.png"
|
filename = "#{attachment_name}-#{Time.now.to_i}.png"
|
||||||
key = "web_apps/#{@app.id}/icons/#{attachment_name}.png"
|
key = "web_apps/#{@app.id}/icons/#{filename}"
|
||||||
|
|
||||||
begin
|
begin
|
||||||
tempfile = Down.download(download_url)
|
tempfile = Down.download(download_url)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user