MCPcopy Index your code
hub / github.com/TeleBoxOrg/TeleBox_Plugins / getConfigNameFromHeader

Method getConfigNameFromHeader

subinfo/subinfo.ts:349–368  ·  view source on GitHub ↗
(contentDisposition: string | null)

Source from the content-addressed store, hash-verified

347
348 // 从 Content-Disposition 头获取配置名称
349 private getConfigNameFromHeader(contentDisposition: string | null): string | null {
350 if (!contentDisposition) return null;
351
352 try {
353 const parts = contentDisposition.split(';');
354 for (const part of parts) {
355 const trimmed = part.trim();
356 if (trimmed.startsWith('filename*=')) {
357 const namePart = trimmed.split("''").pop();
358 if (namePart) return decodeURIComponent(namePart);
359 } else if (trimmed.startsWith('filename=')) {
360 let namePart = trimmed.split('=').slice(1).join('=').trim().replace(/^["']|["']$/g, '');
361 if (namePart) return decodeURIComponent(Buffer.from(namePart, 'binary').toString('utf-8'));
362 }
363 }
364 } catch {
365 // 忽略解析错误
366 }
367 return null;
368 }
369
370 // --- 核心查询逻辑 (Subinfo & Cha 共用) ---
371 private async processSubscription(url: string): Promise<{

Callers 1

processSubscriptionMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected