mirror of
https://github.com/mickael-kerjean/filestash.git
synced 2025-11-01 19:32:27 +08:00
fix (navigation): navigation was braking when a file had a pound in its name
This commit is contained in:
@ -136,7 +136,7 @@ export class PathElementWrapper extends React.Component {
|
|||||||
return (
|
return (
|
||||||
<li className={className}>
|
<li className={className}>
|
||||||
<NgIf cond={this.props.isLast === false}>
|
<NgIf cond={this.props.isLast === false}>
|
||||||
<Link to={"/files" + (this.props.path.full || "/") + location.search} className="label">
|
<Link to={"/files" + ((this.props.path.full || "").replace(/#/g, "%23") || "/") + location.search} className="label">
|
||||||
<NgIf cond={this.props.path.minify !== true}>
|
<NgIf cond={this.props.path.minify !== true}>
|
||||||
{this.limitSize(this.props.path.label)}
|
{this.limitSize(this.props.path.label)}
|
||||||
</NgIf>
|
</NgIf>
|
||||||
|
|||||||
@ -32,7 +32,7 @@ export class FilesPage extends React.Component {
|
|||||||
this.props.history.push(props.match.url + "/");
|
this.props.history.push(props.match.url + "/");
|
||||||
}
|
}
|
||||||
this.state = {
|
this.state = {
|
||||||
path: props.match.url.replace('/files', '') || '/',
|
path: props.match.url.replace('/files', '').replace(/%23/g, "#") || '/',
|
||||||
sort: settings_get('filespage_sort') || 'type',
|
sort: settings_get('filespage_sort') || 'type',
|
||||||
sort_reverse: true,
|
sort_reverse: true,
|
||||||
show_hidden: settings_get('filespage_show_hidden') || CONFIG["display_hidden"],
|
show_hidden: settings_get('filespage_show_hidden') || CONFIG["display_hidden"],
|
||||||
@ -88,7 +88,7 @@ export class FilesPage extends React.Component {
|
|||||||
if(/\/$/.test(path) === false){ path = path + "/"; }
|
if(/\/$/.test(path) === false){ path = path + "/"; }
|
||||||
if(/^\//.test(path) === false){ path = "/"+ path; }
|
if(/^\//.test(path) === false){ path = "/"+ path; }
|
||||||
return path;
|
return path;
|
||||||
}(nextProps.match.params.path);
|
}(nextProps.match.params.path.replace(/%23/g, "#"));
|
||||||
if(new_path !== this.state.path){
|
if(new_path !== this.state.path){
|
||||||
this.setState({path: new_path, loading: true});
|
this.setState({path: new_path, loading: true});
|
||||||
this.onRefresh(new_path);
|
this.onRefresh(new_path);
|
||||||
@ -117,6 +117,7 @@ export class FilesPage extends React.Component {
|
|||||||
let files = new Array(res.results.length);
|
let files = new Array(res.results.length);
|
||||||
for(let i=0,l=res.results.length; i<l; i++){
|
for(let i=0,l=res.results.length; i<l; i++){
|
||||||
let path = this.state.path+res.results[i].name;
|
let path = this.state.path+res.results[i].name;
|
||||||
|
path = path.replace(/#/g, "%23");
|
||||||
if(this.state.show_hidden === false && res.results[i].name[0] === "."){
|
if(this.state.show_hidden === false && res.results[i].name[0] === "."){
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -31,7 +31,7 @@ export class ViewerPage extends React.Component {
|
|||||||
constructor(props){
|
constructor(props){
|
||||||
super(props);
|
super(props);
|
||||||
this.state = {
|
this.state = {
|
||||||
path: props.match.url.replace('/view', '') + (location.hash || ""),
|
path: props.match.url.replace('/view', '').replace(/%23/g, "#") + (location.hash || ""),
|
||||||
url: null,
|
url: null,
|
||||||
filename: Path.basename(props.match.url.replace('/view', '')) || 'untitled.dat',
|
filename: Path.basename(props.match.url.replace('/view', '')) || 'untitled.dat',
|
||||||
opener: null,
|
opener: null,
|
||||||
@ -45,7 +45,7 @@ export class ViewerPage extends React.Component {
|
|||||||
|
|
||||||
componentWillReceiveProps(props){
|
componentWillReceiveProps(props){
|
||||||
this.setState({
|
this.setState({
|
||||||
path: props.match.url.replace('/view', '') + (location.hash || ""),
|
path: props.match.url.replace('/view', '').replace(/%23/g, "#") + (location.hash || ""),
|
||||||
filename: Path.basename(props.match.url.replace('/view', '')) || 'untitled.dat'
|
filename: Path.basename(props.match.url.replace('/view', '')) || 'untitled.dat'
|
||||||
}, () => { this.componentDidMount(); });
|
}, () => { this.componentDidMount(); });
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user