WebURL Documentation Beta

Structure File​Path​From​URLError

public struct FilePathFromURLError: Error, Equatable, Hashable, CustomStringConvertible 

The reason why a file path could not be created from a given URL.

Conforms To

CustomStringConvertible
Equatable
Error
Hashable

Properties

not​AFile​URL

@inlinable
public static var notAFileURL: FilePathFromURLError 

The given URL is not a file: URL.

encoded​Path​Separator

@inlinable
public static var encodedPathSeparator: FilePathFromURLError 

The given URL contains a percent-encoded path separator.

Typically, percent-encoded bytes in a URL are decoded when generating a file path, as percent-encoding is a URL feature that has no meaning to a filesystem. However, if the decoded byte would be interpreted as a path separator in the given FilePathFormat, decoding it would pose a security risk as it could be used to smuggle extra path components, including ".." components.

encoded​Null​Bytes

@inlinable
public static var encodedNullBytes: FilePathFromURLError 

The given URL contains a percent-encoded NULL byte.

Typically, percent-encoded bytes in a URL are decoded when generating a file path, as percent-encoding is a URL feature that has no meaning to a filesystem. However, if the decoded byte is a NULL byte, many systems would interpret that as the end of the path, which poses a security risk as parts of the path could unexpectedly be discarded.

unsupported​Non​Local​File

@inlinable
public static var unsupportedNonLocalFile: FilePathFromURLError 

The given URL refers to a file on a remote host, but they are not supported by the given FilePathFormat.

For example, on POSIX systems, remote filesystems tend to be mounted at locations in the local filesystem, rather than using a special path format. This means it is not obvious how to express a path to a remote filesystem using the posix path format.

unsupported​Hostname

@inlinable
public static var unsupportedHostname: FilePathFromURLError 

Creating a path with the given URL's hostname is not supported.

FilePathFormats which support remote hosts sometimes reserve particular hostnames. For instance, Windows UNC paths with the hostname . are interpreted as referring to local devices (e.g. \\.\COM1). For security reasons, URLs representing such paths are not decoded.

windows​Path​IsNot​Fully​Qualified

@inlinable
public static var windowsPathIsNotFullyQualified: FilePathFromURLError 

The given URL does not represent a fully-qualified Windows path.

file URLs should always represent absolute locations on the filesystem. For Windows platforms, this means it would be incorrect for a file URL to result in anything other than a fully-qualified path. Windows paths are fully-qualified if they are UNC paths (i.e. have hostnames), or if their first component is a drive letter with a trailing separator.

transcoding​Failure

@inlinable
public static var transcodingFailure: FilePathFromURLError 

The path created from the URL could not be transcoded to the system's encoding.

File URLs can preserve the precise bytes of their path components by means of percent-encoding. However, when the platform's native path representation uses non-8-bit code-units, those elements must be transcoded from the percent-encoded 8-bit values to the system's native encoding.

description

public var description: String