Skip to content
Open
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
6 changes: 3 additions & 3 deletions src/store.ts
Original file line number Diff line number Diff line change
Expand Up @@ -967,7 +967,7 @@ export function handelize(path: string): string {
const segments = path.split('/').filter(Boolean);
const lastSegment = segments[segments.length - 1] || '';
const filenameWithoutExt = lastSegment.replace(/\.[^.]+$/, '');
const hasValidContent = /[\p{L}\p{N}$]/u.test(filenameWithoutExt);
const hasValidContent = /[\p{L}\p{N}$+\-=\[\]]/u.test(filenameWithoutExt);
if (!hasValidContent) {
throw new Error(`handelize: path "${path}" has no valid filename content`);
}
Expand All @@ -986,14 +986,14 @@ export function handelize(path: string): string {
const nameWithoutExt = ext ? segment.slice(0, -ext.length) : segment;

const cleanedName = nameWithoutExt
.replace(/[^\p{L}\p{N}$]+/gu, '-') // Keep route marker "$", dash-separate other chars
.replace(/[^\p{L}\p{N}$+\-=\[\]]+/gu, '-') // Keep route marker "$" and operators, dash-separate other chars
.replace(/^-+|-+$/g, ''); // Remove leading/trailing dashes

return cleanedName + ext;
} else {
// For directories, just clean normally
return segment
.replace(/[^\p{L}\p{N}$]+/gu, '-')
.replace(/[^\p{L}\p{N}$+\-=\[\]]+/gu, '-')
.replace(/^-+|-+$/g, '');
}
})
Expand Down