From 9d63c50a2d22d4b62c8df9c622555718a825a81c Mon Sep 17 00:00:00 2001 From: Akinwale Ariwodola Date: Mon, 13 Aug 2018 10:04:02 +0100 Subject: [PATCH] Uri encode filenames with spaces for the media player --- app/src/component/mediaPlayer/view.js | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/app/src/component/mediaPlayer/view.js b/app/src/component/mediaPlayer/view.js index 1bb8f52d..3e92c943 100644 --- a/app/src/component/mediaPlayer/view.js +++ b/app/src/component/mediaPlayer/view.js @@ -261,6 +261,12 @@ class MediaPlayer extends React.PureComponent { return null; } + getEncodedDownloadPath = (fileInfo) => { + const { file_name: fileName } = fileInfo; + const encodedFileName = encodeURIComponent(fileName).replace(/!/g, '%21'); + return fileInfo.download_path.replace(new RegExp(fileName, 'g'), encodedFileName); + } + render() { const { backgroundPlayEnabled, fileInfo, thumbnail, onLayout, style } = this.props; const completedWidth = this.getCurrentTimePercentage() * this.seekerWidth; @@ -279,7 +285,7 @@ class MediaPlayer extends React.PureComponent { return ( -