Skip to content

Commit

Permalink
refactor(components): Exclude Auth Token for External Avatar Images
Browse files Browse the repository at this point in the history
This patch focuses on resolving issues encountered with avatar image loading, specifically addressing the challenges related to CORS (Cross-Origin Resource Sharing) errors.

Changes:
- Removed the `isAuthTokenRequired` flag from the `AttachmentModal` component in various files, including `ProfilePage.js`, `RoomHeaderAvatars.js`, and `DetailsPage.js`. This change is crucial for loading of avatar images that are hosted externally.

Rationale:
- The primary purpose of this modification is to streamline the loading process for avatars by removing the unnecessary inclusion of authentication tokens in requests for external images. This approach aligns with standard practices for handling externally hosted content and aims to enhance compatibility and performance.
- Raised a question here as whether there are cases of avatar images that need authentication: https://github.com/Expensify/App/pull/24425/files#r1404352872

This update is expected to resolve the CORS errors associated with avatar image loading, thereby improving the overall functionality and user experience in our application.
  • Loading branch information
kidroca committed Nov 29, 2023
1 parent 19b605e commit cc49208
Show file tree
Hide file tree
Showing 3 changed files with 0 additions and 4 deletions.
2 changes: 0 additions & 2 deletions src/components/RoomHeaderAvatars.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ function RoomHeaderAvatars(props) {
<AttachmentModal
headerTitle={props.icons[0].name}
source={UserUtils.getFullSizeAvatar(props.icons[0].source, props.icons[0].id)}
isAuthTokenRequired
isWorkspaceAvatar={props.icons[0].type === CONST.ICON_TYPE_WORKSPACE}
originalFileName={props.icons[0].name}
>
Expand Down Expand Up @@ -78,7 +77,6 @@ function RoomHeaderAvatars(props) {
<AttachmentModal
headerTitle={icon.name}
source={UserUtils.getFullSizeAvatar(icon.source, icon.id)}
isAuthTokenRequired
originalFileName={icon.name}
isWorkspaceAvatar={icon.type === CONST.ICON_TYPE_WORKSPACE}
>
Expand Down
1 change: 0 additions & 1 deletion src/pages/DetailsPage.js
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,6 @@ function DetailsPage(props) {
<AttachmentModal
headerTitle={details.displayName}
source={UserUtils.getFullSizeAvatar(details.avatar, details.accountID)}
isAuthTokenRequired
originalFileName={details.originalFileName}
>
{({show}) => (
Expand Down
1 change: 0 additions & 1 deletion src/pages/ProfilePage.js
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,6 @@ function ProfilePage(props) {
<AttachmentModal
headerTitle={displayName}
source={UserUtils.getFullSizeAvatar(avatar, accountID)}
isAuthTokenRequired
originalFileName={originalFileName}
fallbackSource={fallbackIcon}
>
Expand Down

0 comments on commit cc49208

Please sign in to comment.