fix: Improve FileProxy Handling, set Content-Type - #30427
Merged
kodiakhq[bot] merged 6 commits intoOct 13, 2023
Merged
Conversation
When proxying an asset file from Amazon S3 or Google Storage, we previously ignored important headers such as - Content-Type - Content-Length - Cache-Control We also ignored the storage service's HTTP response, effectively assuming 200, and just blindly passed on the content body. In the case of any errors or redirects, we would interpret that (empty or meaningless) body as the asset itself. Instead, we now proxy those HTTP headers and treat any non-200 as an error.
🦋 Changeset detectedLatest commit: 2f933d7 The changes in this PR will be included in the next version bump. This PR includes changesets to release 30 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
Codecov Report
@@ Coverage Diff @@
## develop #30427 +/- ##
===========================================
- Coverage 51.29% 51.14% -0.16%
===========================================
Files 811 805 -6
Lines 15059 15074 +15
Branches 2751 2785 +34
===========================================
- Hits 7725 7709 -16
- Misses 6926 6931 +5
- Partials 408 434 +26
Flags with carried forward coverage won't be shown. Click here to find out more. |
sampaiodiego
approved these changes
Oct 13, 2023
gabriellsh
added a commit
that referenced
this pull request
Oct 16, 2023
…/mentionBot * 'develop' of github.com:RocketChat/Rocket.Chat: feat: add tooltip to badge mentions (#30590) chore: improve `Tag` a11y link (#30636) refactor: Replace `useForm` in favor of RHF on `AppInstallPage` (#30634) fix: Improve FileProxy Handling, set Content-Type (#30427) refactor: `EditRoomInfo` to typescript (#28318) fix: mobile ringing notification missing call id (#30614) fix: Some HTTP requests sent by apps don't have their data parsed into JSON (#30560) test: More tests for groups kick (#30536) fix: Threads breaking after sending messages too fast (#30622) chore: Remove text decoration from room tag (#30606) i18n: Language update from LingoHub 🤖 on 2023-10-10Z (#30613) fix: File attachments have no content when exporting room messages as file (#30596) fix: use setImmediate to handle username update (#30500) chore: `AnalyticsReports` visual adequacy (#30617)
sampaiodiego
added a commit
that referenced
this pull request
Oct 16, 2023
Co-authored-by: Diego Sampaio <8591547+sampaiodiego@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
When proxying an asset file from Amazon S3 or Google Storage, we previously failed to copy forward important headers such as
We also ignored the storage service's HTTP status response, effectively assuming 200, and just blindly passed on the content body. In the case of any errors or redirects, we would interpret that (empty or meaningless) body as the asset itself.
Instead, we now proxy those HTTP headers and treat any non-200 as an error.
Proposed changes (including videos or screenshots)
Content-Type.Issue(s)
Fixes #18312 by proxying the Content-Type header
Steps to test or reproduce
Configure your RC installation to use Amazon S3 as the File Upload Storage Type.
Post a message in a chat room, along with an image attachment.
View the post with the image attachment.
Right-Click on the image and choose "Open Image in New Tab". (Wording is from Chrome. Other browsers will have the same functionality, albeit with different wording.)
Instead of an image, the browser will show text similar to:
Further comments
Content-Typeheader when proxying from S3X-Content-Type-Options: nosniffheader (inapps/meteor/app/cors/server/cors.ts)text/plain)