mirror of
https://github.com/Wei-Shaw/sub2api.git
synced 2026-09-24 16:05:44 +08:00
fix: parseTypes handles array input defensively (prevents .split crash)
This commit is contained in:
@@ -1 +1 @@
|
||||
0.1.108.54
|
||||
0.1.108.55
|
||||
|
||||
@@ -84,7 +84,9 @@ export const PROVIDER_CONFIG_FIELDS: Record<string, ConfigFieldDef[]> = {
|
||||
// --- Helpers ---
|
||||
|
||||
/** Parse comma-separated types string into array. */
|
||||
export function parseTypes(raw: string): string[] {
|
||||
export function parseTypes(raw: string | string[]): string[] {
|
||||
if (Array.isArray(raw)) return raw.map(s => s.trim()).filter(Boolean)
|
||||
if (!raw) return []
|
||||
return raw.split(',').map(s => s.trim()).filter(Boolean)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user