mirror of
https://github.com/snapotter-hq/SnapOtter.git
synced 2026-08-03 07:46:42 +02:00
fix: use strict ASCII assertion in tests and update OpenAPI spec
Replace fragile Unicode-range regex with positive ASCII check (/^[\x20-\x7E]+$/) that also catches emoji and supplementary plane characters. Update OpenAPI spec to document percent-encoding.
This commit is contained in:
@@ -4470,7 +4470,7 @@ paths:
|
|||||||
X-File-Results:
|
X-File-Results:
|
||||||
schema:
|
schema:
|
||||||
type: string
|
type: string
|
||||||
description: JSON mapping of input index to output filename
|
description: Percent-encoded JSON mapping of input index to output filename (decode with decodeURIComponent before JSON.parse)
|
||||||
content:
|
content:
|
||||||
application/zip:
|
application/zip:
|
||||||
schema:
|
schema:
|
||||||
|
|||||||
@@ -156,7 +156,7 @@ describe("X-File-Results header", () => {
|
|||||||
|
|
||||||
expect(res.statusCode).toBe(200);
|
expect(res.statusCode).toBe(200);
|
||||||
const raw = res.headers["x-file-results"] as string;
|
const raw = res.headers["x-file-results"] as string;
|
||||||
expect(raw).not.toMatch(/[-]/);
|
expect(raw).toMatch(/^[\x20-\x7E]+$/);
|
||||||
const fileResults = JSON.parse(decodeURIComponent(raw));
|
const fileResults = JSON.parse(decodeURIComponent(raw));
|
||||||
expect(fileResults["0"]).toContain("图片测试");
|
expect(fileResults["0"]).toContain("图片测试");
|
||||||
expect(fileResults["1"]).toContain("テスト");
|
expect(fileResults["1"]).toContain("テスト");
|
||||||
@@ -182,7 +182,7 @@ describe("X-File-Results header", () => {
|
|||||||
|
|
||||||
expect(res.statusCode).toBe(200);
|
expect(res.statusCode).toBe(200);
|
||||||
const raw = res.headers["x-file-results"] as string;
|
const raw = res.headers["x-file-results"] as string;
|
||||||
expect(raw).not.toMatch(/[-]/);
|
expect(raw).toMatch(/^[\x20-\x7E]+$/);
|
||||||
const fileResults = JSON.parse(decodeURIComponent(raw));
|
const fileResults = JSON.parse(decodeURIComponent(raw));
|
||||||
expect(fileResults["0"]).toContain("normal");
|
expect(fileResults["0"]).toContain("normal");
|
||||||
expect(fileResults["1"]).toContain("élève");
|
expect(fileResults["1"]).toContain("élève");
|
||||||
|
|||||||
@@ -447,7 +447,7 @@ describe("Pipeline batch execution", () => {
|
|||||||
|
|
||||||
expect(res.statusCode).toBe(200);
|
expect(res.statusCode).toBe(200);
|
||||||
const raw = res.headers["x-file-results"] as string;
|
const raw = res.headers["x-file-results"] as string;
|
||||||
expect(raw).not.toMatch(/[-]/);
|
expect(raw).toMatch(/^[\x20-\x7E]+$/);
|
||||||
const fileResults = JSON.parse(decodeURIComponent(raw));
|
const fileResults = JSON.parse(decodeURIComponent(raw));
|
||||||
expect(fileResults["0"]).toContain("图片");
|
expect(fileResults["0"]).toContain("图片");
|
||||||
expect(fileResults["1"]).toContain("写真テスト");
|
expect(fileResults["1"]).toContain("写真テスト");
|
||||||
|
|||||||
Reference in New Issue
Block a user