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

repair path caculate error (#2934)

* repair path caculate error

* improve caculate path algorithm
This commit is contained in:
杨顺强
2019-02-12 14:51:29 +08:00
committed by Daniel Pan
parent 9e9de800c1
commit f3531d553c
2 changed files with 4 additions and 5 deletions

View File

@@ -108,10 +108,9 @@ class DirView extends React.Component {
}); });
} }
let repoName = repoInfo.repo_name;
let repoID = repoInfo.repo_id; let repoID = repoInfo.repo_id;
let path = location.slice(location.indexOf(repoID) + repoID.length); // get the string after repoID let path = location.slice(location.indexOf(repoID) + repoID.length + 1); // get the string after repoID
path = path.slice(path.indexOf(repoName) + repoName.length); // get current path path = path.slice(path.indexOf('/')); // get current path
this.setState({path: path}); this.setState({path: path});
if (!res.data.lib_need_decrypt) { if (!res.data.lib_need_decrypt) {
this.updateDirentList(path); this.updateDirentList(path);

View File

@@ -1,6 +1,6 @@
import React, { Component, Fragment } from 'react'; import React, { Component, Fragment } from 'react';
import PropTypes from 'prop-types'; import PropTypes from 'prop-types';
import { gettext, siteRoot, repoID, slug } from '../../utils/constants'; import { gettext, siteRoot, repoID, slug, username, permission } from '../../utils/constants';
import Logo from '../../components/logo'; import Logo from '../../components/logo';
import Loading from '../../components/loading'; import Loading from '../../components/loading';
import TreeView from '../../components/tree-view/tree-view'; import TreeView from '../../components/tree-view/tree-view';
@@ -73,7 +73,7 @@ class SidePanel extends Component {
{this.props.isTreeDataLoading && <Loading /> } {this.props.isTreeDataLoading && <Loading /> }
{!this.props.isTreeDataLoading && this.props.indexNode && this.renderIndexView() } {!this.props.isTreeDataLoading && this.props.indexNode && this.renderIndexView() }
{!this.props.isTreeDataLoading && !this.props.indexNode && this.renderTreeView() } {!this.props.isTreeDataLoading && !this.props.indexNode && this.renderTreeView() }
<div className="text-left p-2"><a href={siteRoot + 'library/' + repoID + '/' + slug} className="text-dark text-decoration-underline">{gettext('Go to Library')}</a></div> {(username && permission) && <div className="text-left p-2"><a href={siteRoot + 'library/' + repoID + '/' + slug + '/'} className="text-dark text-decoration-underline">{gettext('Go to Library')}</a></div>}
</div> </div>
</div> </div>
); );