Skip to content
Open
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
6 changes: 3 additions & 3 deletions Sources/File System Primitives/File.Path.Error.swift
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ extension File.Path {
///
/// Control characters are invalid in file paths and can cause
/// security issues or unexpected behavior with system calls.
case containsControlCharacters
case containsControlCharacters(String)
}
}

Expand All @@ -26,8 +26,8 @@ extension File.Path.Error: CustomStringConvertible {
switch self {
case .empty:
return "Path is empty"
case .containsControlCharacters:
return "Path contains control characters"
case .containsControlCharacters(let path):
return "Path contains control characters - \(path)"
}
}
}
2 changes: 1 addition & 1 deletion Sources/File System Primitives/File.Path.swift
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ extension File {
// Check for control characters before FilePath conversion
// (FilePath may truncate at NUL, so we validate the original string)
if string.utf8.contains(where: \.ascii.isControl) {
throw .containsControlCharacters
throw .containsControlCharacters(string)
}

self._path = FilePath(string)
Expand Down
Loading