From 4ded73b92743416743e11485cbbd6c9ac63fd7e9 Mon Sep 17 00:00:00 2001 From: Mattermost Build Date: Fri, 14 Aug 2020 14:02:12 -0400 Subject: [PATCH] [MM-26489] No need to decode file URI on Android (#4610) (#4673) * Encode lone % chars * No need to decode on Android (cherry picked from commit 7c827fe319da53747dc63ecaa03c44154d8e942b) Co-authored-by: Miguel Alatzar --- .../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', () => {