groue / GRMustache.swift

Flexible Mustache templates for Swift
http://mustache.github.com/
MIT License
594 stars 155 forks source link

Incorrect use of URL causes failure on files containing spaces. #72

Closed jeff-h closed 1 year ago

jeff-h commented 4 years ago

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.