fix(API基址): VITE_SERVICE_HOST /cms→/yschcms 对齐projman部署上下文;upload校验/菜单剥离兼容新旧前缀
build / build (push) Successful in 2m16s

This commit is contained in:
chenxing
2026-09-07 09:35:11 +08:00
parent 82eb067b19
commit 506fae0097
9 changed files with 24 additions and 19 deletions
+5 -2
View File
@@ -62,16 +62,19 @@ describe("themeParamForm(方案 §6.3/§8.4)", () => {
expect(COLOR_RE.test("javascript:alert(1)")).toBe(false);
});
it("T29: select 枚举外拒绝;image 非 /cms/upload/** 拒绝;空值一律不合法", () => {
it("T29: select 枚举外拒绝;image 仅放行 /cms|/yschcms + /upload/** 前缀;空值一律不合法", () => {
const t = theme();
const select = t.params.find(p => p.key === "headerStyle")!;
const image = t.params.find(p => p.key === "logoImage")!;
const color = t.params.find(p => p.key === "primary")!;
expect(isValidParamValue(select, "plain")).toBe(true);
expect(isValidParamValue(select, "hacker")).toBe(false);
// B-7:与应用真实路径对齐(context-path=/cms),旧 /upload/** 前缀不再放行
// B-7:与应用真实路径对齐,旧 /upload/** 前缀不再放行;
// 兼容历史 /cms/upload/**(本地/旧数据)与现网 /yschcms/upload/**(projman 部署 context-path)
expect(isValidParamValue(image, "/cms/upload/cms/logo.png")).toBe(true);
expect(isValidParamValue(image, "/yschcms/upload/cms/logo.png")).toBe(true);
expect(isValidParamValue(image, "/upload/cms/logo.png")).toBe(false);
expect(isValidParamValue(image, "/yschcmsupload/x.png")).toBe(false);
expect(isValidParamValue(image, "https://evil/x.png")).toBe(false);
expect(isValidParamValue(color, "")).toBe(false);
expect(isValidParamValue(color, undefined)).toBe(false);