mirror of
https://github.com/haiwen/seahub.git
synced 2025-09-01 23:20:51 +00:00
repair bug
This commit is contained in:
@@ -44,7 +44,7 @@ class DirView extends React.Component {
|
|||||||
}
|
}
|
||||||
|
|
||||||
componentDidMount() {
|
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 location = decodeURIComponent(window.location.href);
|
||||||
let repoID = this.props.repoID;
|
let repoID = this.props.repoID;
|
||||||
seafileAPI.getRepoInfo(repoID).then(res => {
|
seafileAPI.getRepoInfo(repoID).then(res => {
|
||||||
@@ -66,8 +66,7 @@ class DirView extends React.Component {
|
|||||||
updateDirentList = (filePath) => {
|
updateDirentList = (filePath) => {
|
||||||
let repoID = this.state.repoID;
|
let repoID = this.state.repoID;
|
||||||
this.setState({isDirentListLoading: true});
|
this.setState({isDirentListLoading: true});
|
||||||
|
const path = Utils.encodePath(filePath);
|
||||||
const path = encodeURIComponent(filePath);
|
|
||||||
seafileAPI.listDir(repoID, path).then(res => {
|
seafileAPI.listDir(repoID, path).then(res => {
|
||||||
let direntList = res.data.map(item => {
|
let direntList = res.data.map(item => {
|
||||||
return new Dirent(item);
|
return new Dirent(item);
|
||||||
@@ -88,7 +87,7 @@ class DirView extends React.Component {
|
|||||||
this.updateDirentList(direntPath);
|
this.updateDirentList(direntPath);
|
||||||
this.setState({path: 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);
|
window.history.pushState({url: fileUrl, path: direntPath}, direntPath, fileUrl);
|
||||||
} else {
|
} else {
|
||||||
const w=window.open('about:blank');
|
const w=window.open('about:blank');
|
||||||
@@ -308,7 +307,7 @@ class DirView extends React.Component {
|
|||||||
this.updateDirentList(path);
|
this.updateDirentList(path);
|
||||||
this.setState({path: 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);
|
window.history.pushState({url: fileUrl, path: path}, path, fileUrl);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -376,7 +376,7 @@ class DirentListItem extends React.Component {
|
|||||||
render() {
|
render() {
|
||||||
let { path, dirent } = this.props;
|
let { path, dirent } = this.props;
|
||||||
let direntPath = Utils.joinPath(path, dirent.name);
|
let direntPath = Utils.joinPath(path, dirent.name);
|
||||||
let href = siteRoot + 'wiki/lib/' + this.props.repoID + direntPath;
|
let href = siteRoot + 'wiki/lib/' + this.props.repoID + Utils.encodePath(direntPath);
|
||||||
return (
|
return (
|
||||||
<Fragment>
|
<Fragment>
|
||||||
<tr className={this.state.highlight ? 'tr-highlight' : ''} onMouseEnter={this.onMouseEnter} onMouseOver={this.onMouseOver} onMouseLeave={this.onMouseLeave}>
|
<tr className={this.state.highlight ? 'tr-highlight' : ''} onMouseEnter={this.onMouseEnter} onMouseOver={this.onMouseOver} onMouseLeave={this.onMouseLeave}>
|
||||||
|
@@ -91,7 +91,7 @@ class SharedRepoListItem extends React.Component {
|
|||||||
});
|
});
|
||||||
|
|
||||||
//todo change to library; div-view is not compatibility
|
//todo change to library; div-view is not compatibility
|
||||||
let libPath = `${siteRoot}library/${this.props.repo.repo_id}/${this.props.repo.repo_name}/`;
|
let libPath = `${siteRoot}library/${repo.repo_id}/${Utils.encodePath(repo.repo_name)}/`;
|
||||||
|
|
||||||
return { iconUrl, iconTitle, libPath };
|
return { iconUrl, iconTitle, libPath };
|
||||||
}
|
}
|
||||||
|
@@ -168,7 +168,7 @@ class Item extends Component {
|
|||||||
'is_admin': data.is_admin,
|
'is_admin': data.is_admin,
|
||||||
'permission': permission
|
'permission': permission
|
||||||
});
|
});
|
||||||
data.url = `${siteRoot}library/${data.repo_id}/`;
|
data.url = `${siteRoot}library/${data.repo_id}/${Utils.encodePath(data.repo_name)}`;
|
||||||
|
|
||||||
let iconVisibility = this.state.showOpIcon ? '' : ' invisible';
|
let iconVisibility = this.state.showOpIcon ? '' : ' invisible';
|
||||||
let shareIconClassName = 'sf2-icon-share sf2-x op-icon' + iconVisibility;
|
let shareIconClassName = 'sf2-icon-share sf2-x op-icon' + iconVisibility;
|
||||||
@@ -243,7 +243,7 @@ class Item extends Component {
|
|||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
{!this.state.showChangeLibName && data.repo_name && (
|
{!this.state.showChangeLibName && data.repo_name && (
|
||||||
<Link to={`${siteRoot}library/${data.repo_id}/${data.repo_name}/`}>{data.repo_name}</Link>
|
<Link to={data.url}>{data.repo_name}</Link>
|
||||||
)}
|
)}
|
||||||
{!this.state.showChangeLibName && !data.repo_name &&
|
{!this.state.showChangeLibName && !data.repo_name &&
|
||||||
(gettext('Broken (please contact your administrator to fix this library)'))
|
(gettext('Broken (please contact your administrator to fix this library)'))
|
||||||
@@ -261,7 +261,7 @@ class Item extends Component {
|
|||||||
<td><img src={data.icon_url} title={data.icon_title} alt={data.icon_title} width="24" /></td>
|
<td><img src={data.icon_url} title={data.icon_title} alt={data.icon_title} width="24" /></td>
|
||||||
<td>
|
<td>
|
||||||
{data.repo_name ?
|
{data.repo_name ?
|
||||||
<Link to={`${siteRoot}library/${data.repo_id}/${data.repo_name}/`}>{data.repo_name}</Link> :
|
<Link to={data.url}>{data.repo_name}</Link> :
|
||||||
gettext('Broken (please contact your administrator to fix this library)')}
|
gettext('Broken (please contact your administrator to fix this library)')}
|
||||||
<br />
|
<br />
|
||||||
<span className="item-meta-info">{Utils.formatSize({bytes: data.size})}</span>
|
<span className="item-meta-info">{Utils.formatSize({bytes: data.size})}</span>
|
||||||
|
Reference in New Issue
Block a user