Skip to content

Commit 004ea0c

Browse files
ctruedenclaude
andcommitted
ImageScSearcher: handle tag objects in Discourse API response
Newer Discourse versions return tags as objects {id, name, slug} rather than plain strings, causing an UnsupportedOperationException. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent c2e1da3 commit 004ea0c

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

src/main/java/org/scijava/search/web/ImageScSearcher.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ private void appendTopicMaps(JsonObject t,
121121
Map<String, String> topicTitleMap, Map<String, String> topicTagMap)
122122
{
123123
topicTitleMap.put(get(t, "id"), get(t, "title"));
124-
topicTagMap.put(get(t, "id"), String.join(", ", StreamSupport.stream(t.get("tags").getAsJsonArray().spliterator(), false).map(j -> j.getAsString()).collect(Collectors.toList())));
124+
topicTagMap.put(get(t, "id"), String.join(", ", StreamSupport.stream(t.get("tags").getAsJsonArray().spliterator(), false).map(j -> j.isJsonObject() ? j.getAsJsonObject().get("name").getAsString() : j.getAsString()).collect(Collectors.toList())));
125125
}
126126

127127
private SearchResult createResult(JsonObject post, Map<String, String> topics, Map<String, String> tags) {

0 commit comments

Comments
 (0)