In several places URL(string:) is called when constructing file paths. I believe these should instead be URL(fileURLWithPath:) calls. The existing code crashes when the filename string contains spaces (or other characters that are illegal in a URL, but not a filename)
let fails = URL(string: "my file.txt") // nil
let works = URL(fileURLWithPath: "my file.txt") // my%20file.txt -- file:///
If anyone agrees I'm more than happy to put up a PR with the changes.
In several places
URL(string:)
is called when constructing file paths. I believe these should instead beURL(fileURLWithPath:)
calls. The existing code crashes when the filename string contains spaces (or other characters that are illegal in a URL, but not a filename)If anyone agrees I'm more than happy to put up a PR with the changes.