Skip to content

Commit

Permalink
fix: Redirect to public on invalid endpoint
Browse files Browse the repository at this point in the history
  • Loading branch information
ZheChrisMajor committed Mar 21, 2023
1 parent 86f2e60 commit 1278bc8
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 1278bc8

Please sign in to comment.