Skip to content

Commit

Permalink
Prevent 500 response when adjunct is empty (#283)
Browse files Browse the repository at this point in the history
  • Loading branch information
Wadeck authored Nov 29, 2021
1 parent 0a78f70 commit c3566a1
Showing 1 changed file with 3 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,9 @@ public Adjunct get(String name) throws IOException {
*/
public void doDynamic(StaplerRequest req, StaplerResponse rsp) throws IOException, ServletException {
String path = req.getRestOfPath();
if (path.length() == 0) {
throw HttpResponses.error(SC_NOT_FOUND,new IllegalArgumentException("No adjunct provided"));
}
if (path.charAt(0)=='/') path = path.substring(1);

if(!allowedResources.contains(path)) {
Expand Down

0 comments on commit c3566a1

Please sign in to comment.