allegroplanet / allegro-planet

1 stars 1 forks source link

Cleanup s3 screenshot urls #32

Closed MarkOates closed 7 years ago

MarkOates commented 7 years ago

Problem

For some reason, CarrierWave and S3 like to generate really nasty URLs that look like this:

https://allegro-planet.s3.amazonaws.com/screenshots/krampus_shot_3.png?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=AKIAIB5BMVW4AB8A%9201456704%2Fus-west-2%2Fs3%2Faws4_request&X-Amz-Date=20170305T055242Z&X-Amz-Expires=900&X-Amz-SignedHeaders=host&X-Amz-Signature=f4aeab5df7dba2a875b4c77ae8b99a9a32cc17ae9bbbd6ca1bc0

Solution

Clean up the URLs by adding a #public_url method directly on the models for GameFile and GameScreenshot. Now URLs would look like this:

https://allegro-planet.s3.amazonaws.com/screenshots/krampus_shot_3.png