remove full path

This commit is contained in:
2026-03-05 17:46:47 +08:00
parent 01b0975abd
commit f8364bea68

View File

@@ -355,6 +355,23 @@ function getGraphArchImage(graphId: string): string | null {
return null; return null;
} }
function sanitizeConfigPath(path: string): string {
if (!path.trim()) {
return path;
}
const normalized = path.replace(/\\/g, "/");
const marker = "/configs/";
const markerIndex = normalized.lastIndexOf(marker);
if (markerIndex >= 0) {
return normalized.slice(markerIndex + 1);
}
const parts = normalized.split("/").filter(Boolean);
if (parts.length >= 2) {
return parts.slice(-2).join("/");
}
return normalized;
}
function toEditable( function toEditable(
config: GraphConfigReadResponse, config: GraphConfigReadResponse,
draft: boolean draft: boolean
@@ -1110,7 +1127,7 @@ export default function App() {
</p> </p>
{mcpConfigPath ? ( {mcpConfigPath ? (
<p className="empty"> <p className="empty">
File: <code>{mcpConfigPath}</code> File: <code>{sanitizeConfigPath(mcpConfigPath)}</code>
</p> </p>
) : null} ) : null}
<p className="empty"> <p className="empty">