escape special characters for the encoded path (#262)
This commit is contained in:
parent
becf21b7ea
commit
e1e8fa410a
1 changed files with 8 additions and 1 deletions
|
@ -30,6 +30,7 @@ class MediaPlayer extends React.PureComponent {
|
|||
constructor(props) {
|
||||
super(props);
|
||||
this.state = {
|
||||
encodedFilePath: null,
|
||||
rate: 1,
|
||||
volume: 1,
|
||||
muted: false,
|
||||
|
@ -284,9 +285,15 @@ class MediaPlayer extends React.PureComponent {
|
|||
}
|
||||
|
||||
getEncodedDownloadPath = (fileInfo) => {
|
||||
if (this.state.encodedFilePath) {
|
||||
return this.state.encodedFilePath;
|
||||
}
|
||||
|
||||
const { file_name: fileName } = fileInfo;
|
||||
const encodedFileName = encodeURIComponent(fileName).replace(/!/g, '%21');
|
||||
return fileInfo.download_path.replace(new RegExp(fileName, 'g'), encodedFileName);
|
||||
const encodedFilePath = fileInfo.download_path.replace(fileName, encodedFileName);
|
||||
this.setState({ encodedFilePath });
|
||||
return encodedFilePath;
|
||||
}
|
||||
|
||||
render() {
|
||||
|
|
Loading…
Reference in a new issue