Skip to content

Commit

Permalink
Handle invalid URIs, return full value instead of host (#630)
Browse files Browse the repository at this point in the history
  • Loading branch information
fsteeg committed Oct 19, 2023
1 parent 241c029 commit 2319161
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion app/views/TableRow.java
Original file line number Diff line number Diff line change
Expand Up @@ -219,10 +219,18 @@ String[] refAndLabel(String property, String value,
}
String label =
labels.isPresent() && labels.get().size() > 0 ? labels.get().get(0)
: value.startsWith("http") ? URI.create(value).getHost() : value;
: value.startsWith("http") ? hostFromUri(value) : value;
return new String[] { value, label };
}

private static String hostFromUri(String value) {
try {
return URI.create(value).getHost();
} catch (IllegalArgumentException e) {
return value;
}
}

public abstract String process(JsonNode doc, String property, String param,
String label, List<String> values, Optional<List<String>> labels);
}

0 comments on commit 2319161

Please sign in to comment.