Commit 8dd1b522 authored by Rafael's avatar Rafael

bugfix: thumbnail name with extension to avoid duplication

parent b37013e5
Pipeline #20394681 passed with stage
in 2 minutes and 12 seconds
......@@ -506,7 +506,10 @@ func getThumbnail(db *sql.DB, mediaURL, photoURL, thumbnailURL string) string {
svc := s3manager.NewUploader(sess)
contentType := "image/png"
imageThumbnailName := fileNoExtension + "-thumbnail.png"
// Save thumbnails always as png (gif doesn't have good resolution)
// But keep extension to avoid overwrites of the same filename
// Eg.: image.gif and image.jpg would both be saved as image-thumbnail.png
imageThumbnailName := fileNoExtension + fileExtension + "-thumbnail.png"
_, err = svc.Upload(&s3manager.UploadInput{
Bucket: aws.String(bucket),
Key: aws.String("media/" + imageThumbnailName),
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment