1
0
mirror of https://github.com/haiwen/seahub.git synced 2025-09-21 19:37:28 +00:00

repair bug

This commit is contained in:
shanshuirenjia
2018-12-13 11:05:47 +08:00
parent c216f199a2
commit c2da62e86b
4 changed files with 9 additions and 10 deletions

View File

@@ -44,7 +44,7 @@ class DirView extends React.Component {
}
componentDidMount() {
//eg: http://127.0.0.1:8000/library/repo_id/repo_name/**/**/
//eg: http://127.0.0.1:8000/library/repo_id/repo_name/**/**/\
let location = decodeURIComponent(window.location.href);
let repoID = this.props.repoID;
seafileAPI.getRepoInfo(repoID).then(res => {
@@ -66,8 +66,7 @@ class DirView extends React.Component {
updateDirentList = (filePath) => {
let repoID = this.state.repoID;
this.setState({isDirentListLoading: true});
const path = encodeURIComponent(filePath);
const path = Utils.encodePath(filePath);
seafileAPI.listDir(repoID, path).then(res => {
let direntList = res.data.map(item => {
return new Dirent(item);
@@ -88,7 +87,7 @@ class DirView extends React.Component {
this.updateDirentList(direntPath);
this.setState({path: direntPath});
let fileUrl = siteRoot + 'library/' + this.state.repoID + '/' + this.state.repoName + direntPath;
let fileUrl = siteRoot + 'library/' + this.state.repoID + '/' + this.state.repoName + Utils.encodePath(direntPath);
window.history.pushState({url: fileUrl, path: direntPath}, direntPath, fileUrl);
} else {
const w=window.open('about:blank');
@@ -308,7 +307,7 @@ class DirView extends React.Component {
this.updateDirentList(path);
this.setState({path: path});
let fileUrl = siteRoot + 'library/' + this.state.repoID + '/' + this.state.repoName + path;
let fileUrl = siteRoot + 'library/' + this.state.repoID + '/' + this.state.repoName + Utils.encodePath(path);
window.history.pushState({url: fileUrl, path: path}, path, fileUrl);
}