Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion lib/svg/generator.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -685,7 +685,7 @@ describe('generateSVG', () => {

it('renders the username in uppercase and escapes XML-reserved characters', () => {
const svg = generateNotFoundSVG('octocat&co', '#0d1117', '#00ffaa', '#ffffff', 8);
expect(svg).toContain('OCTOCAT&CO');
expect(svg).toContain('OCTOCATCO');
});

it('displays the "NOT FOUND" text label', () => {
Expand Down
3 changes: 2 additions & 1 deletion lib/svg/generator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1971,7 +1971,8 @@ export function generateNotFoundSVG(
radius: number,
speed: string = '8s'
): string {
const safeName = escapeXML(username.toUpperCase());
const sanitizedUsername = username.replace(/[^a-zA-Z0-9\-]/g, '').slice(0, 39) || 'unknown';
const safeName = escapeXML(sanitizedUsername.toUpperCase());
const ghostTowersHtml = renderGhostTowers(GHOST_LAYOUT, accent);

const safeId = safeName.replace(/[^a-zA-Z0-9-]/g, '_').toLowerCase();
Expand Down
Loading