From 07b8b030eab4e8bcb6346fdcfb4b05918823261e Mon Sep 17 00:00:00 2001 From: Andelf Date: Mon, 10 Jul 2023 16:10:27 +0800 Subject: [PATCH] fix(ios): empty repo-url on first-boot(logged) --- src/main/frontend/util/text.cljs | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/src/main/frontend/util/text.cljs b/src/main/frontend/util/text.cljs index 8ba35e311..5b4cd63b0 100644 --- a/src/main/frontend/util/text.cljs +++ b/src/main/frontend/util/text.cljs @@ -142,14 +142,17 @@ [value nil nil]))) (defn get-graph-name-from-path - "Get `Dir/GraphName` style name for from repo-url" + "Get `Dir/GraphName` style name for from repo-url. + + On iOS, repo-url might be nil" [repo-url] - (let [path (config/get-local-dir repo-url) - path (if (path/is-file-url? path) - (path/url-to-path path) - path) - parts (->> (string/split path #"/") - (take-last 2))] - (if (not= (first parts) "0") - (util/string-join-path parts) - (last parts)))) + (when (not-empty repo-url) + (let [path (config/get-local-dir repo-url) + path (if (path/is-file-url? path) + (path/url-to-path path) + path) + parts (->> (string/split path #"/") + (take-last 2))] + (if (not= (first parts) "0") + (util/string-join-path parts) + (last parts)))))