From b95ee90c6496b166051999f4561e27e43d855102 Mon Sep 17 00:00:00 2001 From: matevip Date: Mon, 8 Jun 2026 22:48:31 +0800 Subject: [PATCH] fix(wiki,agent): tidy up post-merge review nits - WikiPageTypeProfile: normalise pageType keys to lowercase on set, so a user-authored profile with an uppercase key still matches the case-insensitive hasPageType/get lookups. - WikiDirectoryScanService: normalise the symlink-resolved glob base to forward slashes so directory-scan globs work on Windows paths. - Agents roster tag filter: keep selected tags that no longer exist on any agent visible and deselectable (and show the filter bar when only such orphan selections remain) instead of silently filtering with no way to clear. --- .../wiki/profile/WikiPageTypeProfile.java | 22 +++++++++++++++++++ .../service/WikiDirectoryScanService.java | 5 ++++- mateclaw-ui/src/views/Agents.vue | 7 ++++-- 3 files changed, 31 insertions(+), 3 deletions(-) diff --git a/mateclaw-server/src/main/java/vip/mate/wiki/profile/WikiPageTypeProfile.java b/mateclaw-server/src/main/java/vip/mate/wiki/profile/WikiPageTypeProfile.java index 32de2be7..850a5168 100644 --- a/mateclaw-server/src/main/java/vip/mate/wiki/profile/WikiPageTypeProfile.java +++ b/mateclaw-server/src/main/java/vip/mate/wiki/profile/WikiPageTypeProfile.java @@ -36,6 +36,28 @@ public class WikiPageTypeProfile { */ private boolean allowAdditionalFields = false; + /** + * Normalise keys to lowercase on set so a user-authored profile with an + * uppercase pageType key (e.g. {@code "Concept"}) still matches the + * case-insensitive {@link #hasPageType}/{@link #get} lookups. Replaces the + * Lombok-generated setter (so Jackson deserialization goes through here too). + */ + public void setPageTypes(Map pageTypes) { + Map normalized = new LinkedHashMap<>(); + if (pageTypes != null) { + for (Map.Entry e : pageTypes.entrySet()) { + if (e.getKey() == null) { + continue; + } + String key = e.getKey().trim().toLowerCase(); + if (!key.isEmpty()) { + normalized.put(key, e.getValue()); + } + } + } + this.pageTypes = normalized; + } + /** Whether this profile declares the given pageType (case-insensitive). */ public boolean hasPageType(String pageType) { if (pageType == null) { diff --git a/mateclaw-server/src/main/java/vip/mate/wiki/service/WikiDirectoryScanService.java b/mateclaw-server/src/main/java/vip/mate/wiki/service/WikiDirectoryScanService.java index 1f7e5961..cfd21ebe 100644 --- a/mateclaw-server/src/main/java/vip/mate/wiki/service/WikiDirectoryScanService.java +++ b/mateclaw-server/src/main/java/vip/mate/wiki/service/WikiDirectoryScanService.java @@ -234,7 +234,10 @@ public class WikiDirectoryScanService { // wildcard tail; escape glob metacharacters in the base so a real // directory name containing */?/{}/[] is treated literally. String wildcardTail = pattern.substring(basePath.length()); - String effectivePattern = globEscape(scanRoot.toString()) + wildcardTail; + // Normalise the resolved base to forward slashes: glob uses '/' as its + // separator, and on Windows scanRoot.toString() yields backslashes that + // globEscape would escape, producing a pattern that never matches. + String effectivePattern = globEscape(scanRoot.toString().replace('\\', '/')) + wildcardTail; try { matcher = FileSystems.getDefault().getPathMatcher("glob:" + effectivePattern); } catch (IllegalArgumentException e) { diff --git a/mateclaw-ui/src/views/Agents.vue b/mateclaw-ui/src/views/Agents.vue index f1fe4a51..d555b5b0 100644 --- a/mateclaw-ui/src/views/Agents.vue +++ b/mateclaw-ui/src/views/Agents.vue @@ -59,7 +59,7 @@ -
+
{{ t('agents.tagFilter.label') }}