* Dont allow community urls like /c/{id} (fixes #611) * Also remove usage of numeric ids for user profiles * fix * fix
This commit is contained in:
parent
f1c5c60c76
commit
06c3e547fb
2 changed files with 6 additions and 32 deletions
|
@ -166,17 +166,8 @@ export class Community extends Component<any, State> {
|
|||
let pathSplit = req.path.split("/");
|
||||
let promises: Promise<any>[] = [];
|
||||
|
||||
// It can be /c/main, or /c/1
|
||||
let idOrName = pathSplit[2];
|
||||
let id: number;
|
||||
let name_: string;
|
||||
if (isNaN(Number(idOrName))) {
|
||||
name_ = idOrName;
|
||||
} else {
|
||||
id = Number(idOrName);
|
||||
}
|
||||
|
||||
let communityForm: GetCommunity = id ? { id } : { name: name_ };
|
||||
let communityName = pathSplit[2];
|
||||
let communityForm: GetCommunity = { name: communityName };
|
||||
setOptionalAuth(communityForm, req.auth);
|
||||
promises.push(req.client.getCommunity(communityForm));
|
||||
|
||||
|
@ -204,7 +195,7 @@ export class Community extends Component<any, State> {
|
|||
saved_only: false,
|
||||
};
|
||||
setOptionalAuth(getPostsForm, req.auth);
|
||||
this.setName(getPostsForm, name_);
|
||||
this.setName(getPostsForm, communityName);
|
||||
promises.push(req.client.getPosts(getPostsForm));
|
||||
} else {
|
||||
let getCommentsForm: GetComments = {
|
||||
|
@ -214,7 +205,7 @@ export class Community extends Component<any, State> {
|
|||
type_: ListingType.Community,
|
||||
saved_only: false,
|
||||
};
|
||||
this.setName(getCommentsForm, name_);
|
||||
this.setName(getCommentsForm, communityName);
|
||||
setOptionalAuth(getCommentsForm, req.auth);
|
||||
promises.push(req.client.getComments(getCommentsForm));
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue