MCPcopy Create free account
hub / github.com/027xiguapi/code-box / getExt

Function getExt

contents/weixin.tsx:309–317  ·  view source on GitHub ↗
(url: string)

Source from the content-addressed store, hash-verified

307 const total = imageEntries.length + 1
308
309 const getExt = (url: string) => {
310 const fmt = url.match(/wx_fmt=(\w+)/)?.[1] || ""
311 if (fmt === "gif") return ".gif"
312 if (fmt === "png" || fmt === "webp") return ".png"
313 if (fmt === "bmp") return ".bmp"
314 if (url.includes("mmbiz_gif")) return ".gif"
315 if (url.includes("mmbiz_png") || url.includes("mmbiz_webp")) return ".png"
316 return ".jpg"
317 }
318
319 // 下载图片并替换 markdown 中的 URL
320 for (let i = 0; i < imageEntries.length; i++) {

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected