Skip to content

Commit

Permalink
Merge pull request #57 from Academic-Weapons/gh-issue-54
Browse files Browse the repository at this point in the history
fix: Redirect to public on invalid endpoint
  • Loading branch information
ZheChrisMajor authored Mar 21, 2023
2 parents 86f2e60 + 1278bc8 commit ab544dd
Showing 1 changed file with 8 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,14 @@ public String userTimeLine(@PathVariable("username") String username, HttpServle
model.addAttribute("public", "false");
model.addAttribute("username", username);
Boolean loggedIn = addUserToModel(model, session);


List<Object> arg = new ArrayList<>(); //
arg.add(username); //
List<Map<String, Object>> users; // check if there is a user with this name
users = sqLite.queryDb("select * from user where user.username = ?", arg); // redirect to public if there is no such user
if (users.size()==0) return "redirect:/public"; // todo redirect to error page insted


if (loggedIn) {
//TODO bliver kaldt af favicon ??
// System.out.println("username: " + username);
Expand Down

0 comments on commit ab544dd

Please sign in to comment.