|
|
@@ -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();
|
|
|
+ }
|
|
|
}
|