cagataygurturk / image-resizer-service

Serverless image resizing service for AWS
https://serverlessrepo.aws.amazon.com/#/applications/arn:aws:serverlessrepo:us-east-1:526515951862:applications~image-resizer-service
MIT License
101 stars 51 forks source link

fix a bug with subdirectories #5

Closed tadaspaplauskas closed 5 years ago

tadaspaplauskas commented 5 years ago

Mentioned here: https://github.com/cagataygurturk/image-resizer-service/issues/3

The function crashes if image is in a nested folder, as it does not handle / symbols in the temporary file path:

2018-11-28T11:10:35.727Z    ERROR 500 null { Error: Command failed: convert: unable to open image `/tmp/resized.bucket.example.com.a/1032/1/example/1/4/screenshots/original.png.300.300': No such file or directory @ error/blob.c/OpenBlob/2643.
convert: WriteBlob Failed `/tmp/resized.bucket.example.com.a/1032/1/example/1/4/screenshots/original.png.300.300' @ error/png.c/MagickPNGErrorHandler/1751.

This PR fixes the issue by replacing / with . when creating a resized file.

cagataygurturk commented 5 years ago

Your commit was merged via manual commit since I haven't noticed the PR. Thanks for the contribution!