escape special characters for the encoded path #262

Merged
akinwale merged 3 commits from escape-filenames into master 2018-08-27 19:14:30 +02:00
Showing only changes of commit 6907f478ec - Show all commits

View file

@ -291,10 +291,7 @@ class MediaPlayer extends React.PureComponent {
const { file_name: fileName } = fileInfo;
const encodedFileName = encodeURIComponent(fileName).replace(/!/g, '%21');
const re = new RegExp(fileName.replace(/\-/g, '\\-')
.replace(/\(/g, '\\(')
.replace(/\)/g, '\\)'), 'g');
const encodedFilePath = fileInfo.download_path.replace(re, encodedFileName);
const encodedFilePath = fileInfo.download_path.replace(fileName, encodedFileName);
this.setState({ encodedFilePath });
return encodedFilePath;
}