























@@ -40,6 +40,10 @@ describe("splitMediaFromOutput", () => {
4040expectParsedMediaOutputCase(input, { mediaUrls: undefined });
4141}
424243+function expectRejectedRemoteMediaUrlCase(input: string) {
44+expectParsedMediaOutputCase(input, { mediaUrls: undefined, text: input });
45+}
46+4347it.each([
4448["/Users/pete/My File.png", "MEDIA:/Users/pete/My File.png"],
4549["/Users/pete/My File.png", 'MEDIA:"/Users/pete/My File.png"'],
@@ -63,6 +67,24 @@ describe("splitMediaFromOutput", () => {
6367expectRejectedMediaPathCase(input);
6468});
656970+it.each([
71+"MEDIA:http://example.com/a.png",
72+"MEDIA:https://intranet/a.png",
73+"MEDIA:https://printer/a.png",
74+"MEDIA:https://localhost/a.png",
75+"MEDIA:https://localhost../a.png",
76+"MEDIA:https://127.0.0.1/a.png",
77+"MEDIA:https://127.0.0.1../a.png",
78+"MEDIA:https://169.254.169.254/latest/meta-data",
79+"MEDIA:https://[::1]/a.png",
80+"MEDIA:https://metadata.google.internal/a.png",
81+"MEDIA:https://metadata.google.internal../a.png",
82+"MEDIA:https://example..com/a.png",
83+"MEDIA:https://media.local/a.png",
84+] as const)("rejects unsafe remote media URL: %s", (input) => {
85+expectRejectedRemoteMediaUrlCase(input);
86+});
87+6688it.each([
6789{
6890name: "detects audio_as_voice tag and strips it",
@@ -149,6 +171,8 @@ describe("splitMediaFromOutput", () => {
149171"",
150172"",
151173"",
174+"",
175+"",
152176] as const)("does not lift local markdown image target: %s", (input) => {
153177expectParsedMediaOutputCase(input, {
154178text: input,
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。