mirror of
https://github.com/overleaf/overleaf.git
synced 2024-11-07 20:31:06 -05:00
Explain to the user that their project is inaccessible
This commit is contained in:
parent
8b4c29ec83
commit
20a748f14e
1 changed files with 19 additions and 2 deletions
|
@ -78,8 +78,7 @@ public class Oauth2Filter implements Filter {
|
|||
);
|
||||
return;
|
||||
} catch (DisabledRepositoryException e) {
|
||||
Log.info("[{}] Git access disabled", project);
|
||||
throw new ServletException(e);
|
||||
disabled(project, (HttpServletResponse) servletResponse);
|
||||
}
|
||||
Log.info("[{}] Auth not needed", project);
|
||||
filterChain.doFilter(servletRequest, servletResponse);
|
||||
|
@ -204,4 +203,22 @@ public class Oauth2Filter implements Filter {
|
|||
w.close();
|
||||
}
|
||||
|
||||
private void disabled(
|
||||
String projectName,
|
||||
HttpServletResponse response
|
||||
) throws IOException {
|
||||
Log.info("[{}] Git access to project disabled.", projectName);
|
||||
|
||||
response.setContentType("text/plain");
|
||||
|
||||
// git special-cases 404 to give "repository '%s' not found",
|
||||
// rather than displaying the raw status code.
|
||||
response.setStatus(404);
|
||||
|
||||
PrintWriter w = response.getWriter();
|
||||
w.println("This project is not accessible over Git.");
|
||||
w.println();
|
||||
w.println("If you think this is an error, contact support at support@overleaf.com.");
|
||||
w.close();
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue