Serve static gz versions in download files #219
Replies: 5 comments 8 replies
-
Good catch, I never noticed that! (update: verified in history that this behavior is there since the beginning..) |
Beta Was this translation helpful? Give feedback.
-
@JosePineiro : maybe because originally, ESPASyncWS was shipped with a file browser / upload UI, so let's say the UI lists the content of the folder
with download == true:
with download == false (file serving), if we happen to have both files on disk, What you are asking for is to align these 2 behaviors (file serving and file download) so that any gz version will hide and be picked up when the non-gzipped version is requested. I don't know how much it breaks backward compatibility.... |
Beta Was this translation helpful? Give feedback.
-
The current condition is: if (!download && !fs.exists(path) && fs.exists(gzPath))
Do you see any flaw, or breaks backward compatibility, in this behavior? |
Beta Was this translation helpful? Give feedback.
-
I agree there is no best answer here. I would prefer to change the default behavior to what you proposed first. It would be consistent also both for resource serving and file download. We have to wait for @me-no-dev to read this discussion and comment because he is the original author who introduced this different behavior. Maybe there are other reasons too… I would like to have this discussion sorted out and if a PR is required, wait for it to be merged before cutting a new release with all the latest changes. |
Beta Was this translation helpful? Give feedback.
-
Merged pull request whit this change |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
When this function is called requesting a file (e.g., image.jpg), it looks for an image.jpg.gz file and, if found, sends it using the Content_Encoding = gzip header.
This behavior is disabled when download=true.
Is there a reason for this?
I suggest removing this limitation, as files can also be sent with Content_Encoding = gzip encoding.
Beta Was this translation helpful? Give feedback.
All reactions