georstat/react-native-image-cache

Caching images with tokens in URL (Amazon S3 bucket image)

RomanSytnyk opened this issue · 2 comments

It would be nice to have a possibility to implement custom cache key in the library.

For instance, in the case of using Amazon S3 bucket, images cannot be cached due to tokens in the URL which change with every new request.
An example of such URL:
https://some-storage.s3.eu-west-2.amazonaws.com/uploads/image/filename/947/photo.jpg?response-content-disposition=attachment%3B%20filename%3D%22photo.jpg%22&X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=creds&X-Amz-Date=20220609T105229Z&X-Amz-Expires=900&X-Amz-SignedHeaders=host&X-Amz-

In this case, it can be cached by the URL without params as https://some-storage.s3.eu-west-2.amazonaws.com/uploads/image/filename/947/photo.jpg, without all the params.

I suggest there can be other cases, where a user can require custom cache key.

Hi!
I've tried to resolve this issue in the pull request.
I'll appreciate your feedback to my contribution.

Thank you

Seems good, we will update the docs and release it shortly.

Released at 2.2.0, check it out here

Thanks for the PR