Refactored sanitizePath to sanitizeFilePath.