From 7c827fe319da53747dc63ecaa03c44154d8e942b Mon Sep 17 00:00:00 2001 From: Miguel Alatzar Date: Fri, 24 Jul 2020 11:42:00 -0700 Subject: [PATCH] [MM-26489] No need to decode file URI on Android (#4610) * Encode lone % chars * No need to decode on Android --- .../post_draft/quick_actions/file_quick_action/index.js | 6 ++++-- app/utils/file.test.js | 6 +++++- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/app/components/post_draft/quick_actions/file_quick_action/index.js b/app/components/post_draft/quick_actions/file_quick_action/index.js index 536b9ec97..337f7b859 100644 --- a/app/components/post_draft/quick_actions/file_quick_action/index.js +++ b/app/components/post_draft/quick_actions/file_quick_action/index.js @@ -68,8 +68,10 @@ export default class FileQuickAction extends PureComponent { } } - // Decode file uri to get the actual path - res.uri = decodeURIComponent(res.uri); + if (Platform.OS === 'ios') { + // Decode file uri to get the actual path + res.uri = decodeURIComponent(res.uri); + } this.props.onUploadFiles([res]); } catch (error) { diff --git a/app/utils/file.test.js b/app/utils/file.test.js index 25430d79f..1e36ebdf3 100644 --- a/app/utils/file.test.js +++ b/app/utils/file.test.js @@ -1,7 +1,11 @@ // Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved. // See LICENSE.txt for license information. -import {generateId, getLocalFilePathFromFile, getExtensionFromContentDisposition} from 'app/utils/file'; +import { + generateId, + getLocalFilePathFromFile, + getExtensionFromContentDisposition, +} from 'app/utils/file'; describe('getExtensionFromContentDisposition', () => { it('should return the extracted the extension', () => {