MCPcopy Create free account
hub / github.com/chokcoco/iCSS / extractImageFromBody

Method extractImageFromBody

website/app/lib/github.ts:62–78  ·  view source on GitHub ↗
(body: string)

Source from the content-addressed store, hash-verified

60
61 // 从 issue 内容中提取图片
62 private static extractImageFromBody(body: string): string | undefined {
63 if (!body) return undefined;
64
65 // 匹配 Markdown 图片 ![alt](url)
66 const markdownImageMatch = body.match(/!\[.*?\]\((https?:\/\/[^)]+\.(?:png|jpg|jpeg|gif|webp))\)/);
67 if (markdownImageMatch) {
68 return markdownImageMatch[1];
69 }
70
71 // 匹配 HTML 图片标签 <img src="...">
72 const htmlImageMatch = body.match(/<img[^>]+src\s*=\s*["'](https?:\/\/[^"']+\.(?:png|jpg|jpeg|gif|webp))["'][^>]*>/);
73 if (htmlImageMatch) {
74 return htmlImageMatch[1];
75 }
76
77 return undefined;
78 }
79
80 // 从 issue 内容中提取分类
81 private static extractCategoryFromBody(body: string): string | undefined {

Callers 2

getIssueMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected