DIYgod/RSSHub · warning
Invalid country
Error message
Invalid country
What it means
Thrown by the fashionnetwork headline route when the `country` path parameter (default 'ww') fails isValidHost. The value is interpolated into `https://${country}.fashionnetwork.com`, so it must be a single safe DNS label.
Source
Thrown at lib/routes-deprecated/fashionnetwork/headline.js:8
const got = require('@/utils/got');
const cheerio = require('cheerio');
const { isValidHost } = require('@/utils/valid-host');
module.exports = async (ctx) => {
const country = ctx.params.country || 'ww';
if (!isValidHost(country)) {
throw new Error('Invalid country');
}
const rootUrl = `https://${country}.fashionnetwork.com`;
const response = await got({
method: 'get',
url: rootUrl,
});
const $ = cheerio.load(response.data);
const list = $('.point-carousel__item')
.slice(5, 10)
.map((_, item) => {
item = $(item);
const a = item.find('.family-title a');
return {
title: a.text(),View on GitHub (pinned to bed535e087)
Solutions
- Use a valid fashionnetwork country label (e.g. 'ww', 'fr', 'cn', 'us').
- Omit the country segment to use the 'ww' default.
- Avoid dots, slashes, and protocols in the value.
Example fix
// before /fashionnetwork/headline/fr.fashionnetwork.com // after /fashionnetwork/headline/fr
Defensive patterns
Strategy: validation
Validate before calling
import { isValidHost } from '@/utils/valid-host';
const country = params.country ?? 'ww';
if (!isValidHost(country)) throw new Error('Invalid country'); Type guard
const isSafeCountry = (v: unknown): boolean =>
typeof v === 'string' && /^[a-z0-9-]+$/i.test(v) && !v.includes('.'); Prevention
- Pass only single-label country codes.
- Default to 'ww' when the segment is omitted.
When it happens
Trigger: Request to /fashionnetwork/headline/:country with a country containing dots, slashes, protocol characters, or other invalid host characters.
Common situations: Typo; passing 'fr.fashionnetwork.com' instead of 'fr'; attempting traversal.
Related errors
AI-assisted analysis of DIYgod/RSSHub@bed535e087 (2026-08-12).
Data as JSON: /api/errors/0db822d6854de64b.
Report an issue: GitHub.