MCPcopy Create free account
hub / github.com/Gan-Xing/CodexBridge / mimeToExtension

Function mimeToExtension

src/cli.ts:691–706  ·  view source on GitHub ↗
(contentType: string)

Source from the content-addressed store, hash-verified

689}
690
691function mimeToExtension(contentType: string) {
692 const value = String(contentType).toLowerCase();
693 if (value.includes('svg')) {
694 return 'svg';
695 }
696 if (value.includes('jpeg') || value.includes('jpg')) {
697 return 'jpg';
698 }
699 if (value.includes('webp')) {
700 return 'webp';
701 }
702 if (value.includes('gif')) {
703 return 'gif';
704 }
705 return 'png';
706}
707
708function sanitizeFileSegment(value: unknown) {
709 return String(value).replace(/[^a-zA-Z0-9._-]+/gu, '-').slice(0, 120) || 'weixin-qr';

Callers 1

materializeQrArtifactFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected