feature(enhanced_media_support): added new options to override media filename #326
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Sometimes you need to enforce the filename of a media file.
When you serve files from a CDN, you usually add a hashed file name to ensure you will not overwrite any of the files on your bucket.
Let's say you want to send a media file with the URL
https://contabilizapro-prod.s3.sa-east-1.amazonaws.com/u_c927690c-2357-4c67-af9a-2b7d6d6ab0f5/15bb57a1-0c1b-4b01-87e0-6bcd40960c87.pdf?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Content-Sha256=UNSIGNED-PAYLOAD&X-Amz-Credential=AKIAR6MREG3VUTRI4FXQ%2F20250321%2Fsa-east-1%2Fs3%2Faws4_request&X-Amz-Date=20250321T203910Z&X-Amz-Expires=60&X-Amz-Signature=7d6011a27925ee6dbd8aca8d8d0a872ae16f15616c3d7a187179716c8439a8d6&X-Amz-SignedHeaders=host&response-content-disposition=attachment%3B%20filename%3Ddummy.pdf.pdf&x-id=GetObject
(s3 public signed URL example), you will receive a file with a hashed file name, like this:That is really bad for the user experience, who will need to open the file to see what is. Overwriting the file name can help the user to identify the file without opening it.
This PR fixes that, and now the same URL above will send a file like this:
Request payload example