{"record":{"id":"5cbbfce2f751e8c7","repo":"DIYgod/RSSHub","slug":"invalid-number","errorCode":null,"errorMessage":"Invalid number","messagePattern":"Invalid number","errorType":"validation","errorClass":"InvalidParameterError","httpStatus":null,"severity":"warning","filePath":"lib/routes/bt0/mv.ts","lineNumber":37,"sourceCode":"    radar: [\n        {\n            source: ['2bt0.com/mv/'],\n        },\n    ],\n    name: '影视资源下载列表',\n    maintainers: ['miemieYaho'],\n    handler,\n};\n\nasync function handler(ctx) {\n    const domain = ctx.req.param('domain') ?? '2';\n    const number = ctx.req.param('number');\n    if (!/^[1-9]$/.test(domain)) {\n        throw new InvalidParameterError('Invalid domain');\n    }\n    const regex = /^\\d{6,}$/;\n    if (!regex.test(number)) {\n        throw new InvalidParameterError('Invalid number');\n    }\n\n    const host = `https://www.${domain}bt0.com`;\n    const _link = `${host}/prod/core/system/getVideoDetail/${number}`;\n\n    const data = (await doGot(0, host, _link)).data;\n    const items = Object.values<any[]>(data.ecca).flatMap((item) =>\n        item.map((i) => ({\n            title: i.zname,\n            guid: i.zname,\n            description: `${i.zname}[${i.zsize}]`,\n            link: `${host}/tr/${i.id}.html`,\n            pubDate: i.ezt,\n            enclosure_type: 'application/x-bittorrent',\n            enclosure_url: i.zlink,\n            enclosure_length: genSize(i.zsize),\n            category: strsJoin(i.zqxd, i.text_html, i.audio_html, i.new === 1 ? '新' : ''),\n        }))","sourceCodeStart":19,"sourceCodeEnd":55,"githubUrl":"https://github.com/DIYgod/RSSHub/blob/bed535e0879dc71c5aff6f1e7bd1ac21ede40115/lib/routes/bt0/mv.ts#L19-L55","documentation":"InvalidParameterError thrown when the `number` path param of /bt0/mv/:domain/:number does not match /^\\d{6,}$/ (six or more digits). The number is interpolated directly into the getVideoDetail API path, so this guard prevents malformed/abusive path injection.","triggerScenarios":"A request where the number param contains non-digits, is shorter than 6 characters, or is missing entirely (undefined fails the regex test).","commonSituations":"Omitting the number param; passing a video title or alphanumeric id; passing a 4-5 digit id.","solutions":["Provide a numeric id of at least 6 digits, copied from the bt0 site's video detail URL.","Confirm the route path includes both :domain and :number segments."],"exampleFix":"// before\nif (!regex.test(number)) {\n    throw new InvalidParameterError('Invalid number');\n}\n// after\nif (!regex.test(number)) {\n    throw new InvalidParameterError(`Invalid number '${number}': expected 6+ digits`);\n}","handlingStrategy":"validation","validationCode":"const NUMBER_RE = /^\\d{6,}$/;\nif (!NUMBER_RE.test(number)) {\n    throw new InvalidParameterError(`Invalid number '${number}': expected 6+ digits`);\n}","typeGuard":"const isBt0Number = (n: string): boolean => /^\\d{6,}$/.test(n);","tryCatchPattern":null,"preventionTips":["Document that number is the 6+ digit video id from the bt0 detail URL.","Reject early to avoid injecting malformed values into the API path."],"tags":["bt0","validation","path-parameter","regex"],"backgroundTag":null,"analyzedSha":"bed535e0879dc71c5aff6f1e7bd1ac21ede40115","analyzedAt":"2026-08-12T19:29:35.364Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}