mirror of
https://github.com/readest/readest.git
synced 2026-04-28 19:42:21 +00:00
fix(ios): decode percent-encoded file URIs in copy_uri_to_path (#3553)
This commit is contained in:
parent
3831f24ff7
commit
b2bb92036b
1 changed files with 12 additions and 2 deletions
|
|
@ -836,8 +836,18 @@ class NativeBridgePlugin: Plugin {
|
|||
return invoke.reject("URI and destination path must be provided")
|
||||
}
|
||||
|
||||
guard let uri = URL(string: uriString) else {
|
||||
return invoke.reject("Invalid URI")
|
||||
let uri: URL
|
||||
if uriString.hasPrefix("file://") {
|
||||
let path = String(uriString.dropFirst("file://".count))
|
||||
guard let decodedPath = path.removingPercentEncoding else {
|
||||
return invoke.reject("Invalid URI encoding")
|
||||
}
|
||||
uri = URL(fileURLWithPath: decodedPath)
|
||||
} else {
|
||||
guard let parsed = URL(string: uriString) else {
|
||||
return invoke.reject("Invalid URI")
|
||||
}
|
||||
uri = parsed
|
||||
}
|
||||
|
||||
let fileManager = FileManager.default
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue