Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[FIX 17237] Updated usages of source. #19107

Merged
merged 10 commits into from
May 22, 2023
6 changes: 3 additions & 3 deletions src/components/AttachmentModal.js
Original file line number Diff line number Diff line change
Expand Up @@ -250,7 +250,7 @@ class AttachmentModal extends PureComponent {
}

render() {
const source = this.state.source;
const source = this.props.source || this.state.source;
return (
<>
<Modal
Expand All @@ -274,7 +274,7 @@ class AttachmentModal extends PureComponent {
title={this.props.headerTitle || this.props.translate('common.attachment')}
shouldShowBorderBottom
shouldShowDownloadButton={this.props.allowDownload}
onDownloadButtonPress={() => this.downloadAttachment(source)}
onDownloadButtonPress={() => this.downloadAttachment(this.state.source)}
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

source from here was previously set to this.state.source and the download functionality was working properly. By updating this, after I was downloading an image, I couldn't open it locally because it was wrongly downloaded. Updated it back to fix this & updated the QA steps with this use case.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you elaborate more on the issue ? how is it "wrongly downloaded" ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Trying to open the file after downloading it shows me this:
image

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah I see it , the downloadAttachment require urls to be singed ( with auth signature ) , if url isn’t signed you can’t download them

onCloseButtonPress={() => this.setState({isModalOpen: false})}
/>
<View style={styles.imageModalImageCenterContainer}>
Expand All @@ -286,7 +286,7 @@ class AttachmentModal extends PureComponent {
onToggleKeyboard={this.updateConfirmButtonVisibility}
/>
) : (
Boolean(this.state.source) &&
Boolean(source) &&
this.state.shouldLoadAttachment && (
<AttachmentView
containerStyles={[styles.mh5]}
Expand Down