sanitizeName = (name) => {
  if (!name) return '';
  
  const invalidCharacters = /[<>:"/\\|?*\x00-\x1F]/g;
  return name
    .replace(invalidCharacters, '-')       // replace invalid characters with hyphens
    .replace(/^[.\s-]+/, '')               // remove leading dots, hyphens and spaces
    .replace(/[.\s]+$/, '');               // remove trailing dots and spaces (keep trailing hyphens)
}
Sanitizes a filename to make it safe for filesystem operations

@param {string} name - The name to sanitize
@returns {string} - The sanitized name