fix: check ios? before forcing private part

This commit is contained in:
Tienson Qin
2022-11-09 23:11:04 +08:00
parent 1c2e769bf2
commit bb829f227b
2 changed files with 15 additions and 13 deletions

View File

@@ -216,20 +216,22 @@
(defn ios-force-include-private
"iOS sometimes return paths without the private part."
[path]
(cond
(string/includes? path "///private/")
path
(if (mobile-util/native-ios?)
(cond
(string/includes? path "///private/")
path
(string/includes? path "///")
(let [[prefix others] (string/split path "///")]
(str prefix "///private/" others))
(string/includes? path "///")
(let [[prefix others] (string/split path "///")]
(str prefix "///private/" others))
:else
(do
(state/pub-event! [:instrument {:type :error/ios-path-missing-slashes
;; respect user's privacy
:path (gp-util/safe-subs path 10)}])
path)))
:else
(do
(state/pub-event! [:instrument {:type :error/ios-path-missing-slashes
;; respect user's privacy
:path (gp-util/safe-subs path 10)}])
path))
path))
(defn normalize-file-protocol-path [dir path]
(let [dir (some-> dir (string/replace #"/+$" ""))