[FIX] AttachmentView crashing during title decode (#2253)
Co-authored-by: Diego Mello <diegolmello@gmail.com>
This commit is contained in:
parent
362ef0085e
commit
5b3be4ef0b
|
@ -70,10 +70,15 @@ class AttachmentView extends React.Component {
|
||||||
setHeader = () => {
|
setHeader = () => {
|
||||||
const { route, navigation, theme } = this.props;
|
const { route, navigation, theme } = this.props;
|
||||||
const attachment = route.params?.attachment;
|
const attachment = route.params?.attachment;
|
||||||
const { title } = attachment;
|
let { title } = attachment;
|
||||||
|
try {
|
||||||
|
title = decodeURI(title);
|
||||||
|
} catch {
|
||||||
|
// Do nothing
|
||||||
|
}
|
||||||
const options = {
|
const options = {
|
||||||
|
title,
|
||||||
headerLeft: () => <CloseModalButton testID='close-attachment-view' navigation={navigation} buttonStyle={{ color: themes[theme].previewTintColor }} />,
|
headerLeft: () => <CloseModalButton testID='close-attachment-view' navigation={navigation} buttonStyle={{ color: themes[theme].previewTintColor }} />,
|
||||||
title: decodeURI(title),
|
|
||||||
headerRight: () => <SaveButton testID='save-image' onPress={this.handleSave} buttonStyle={{ color: themes[theme].previewTintColor }} />,
|
headerRight: () => <SaveButton testID='save-image' onPress={this.handleSave} buttonStyle={{ color: themes[theme].previewTintColor }} />,
|
||||||
headerBackground: () => <View style={{ flex: 1, backgroundColor: themes[theme].previewBackground }} />,
|
headerBackground: () => <View style={{ flex: 1, backgroundColor: themes[theme].previewBackground }} />,
|
||||||
headerTintColor: themes[theme].previewTintColor,
|
headerTintColor: themes[theme].previewTintColor,
|
||||||
|
|
Loading…
Reference in New Issue