apple / swift-docc

Documentation compiler that produces rich API reference documentation and interactive tutorials for your Swift framework or package.
https://swift.org/documentation/docc
Apache License 2.0
1.14k stars 118 forks source link

optional force unwrap fails if target name contains special characters #944

Open tayloraswift opened 3 weeks ago

tayloraswift commented 3 weeks ago

Description

some characters such as space cannot be encoded in a URL host name, even with percent encoding. this causes optional force unwrap of the URL to fail at runtime, causing a DocC preview crash.

it can be reproduced on Linux by running the command below on this commit of the test package https://github.com/tayloraswift/snippets-example/commit/968f351f28239860f1f81367909d6578e4f951ba

swift package --disable-sandbox preview-documentation --target Snippets\ Example

@Kyle-Ye followed these steps, changing the manifest for macOS compatibility, and took this screenshot from a debugger:

image

Checklist

Swift-DocC Version Information

Plugin version 1.3.0

Swift Compiler Version Information

Swift version 5.10 (swift-5.10-RELEASE)
Target: x86_64-unknown-linux-gnu