瀏覽代碼

fix(ios): empty repo-url on first-boot(logged)

Andelf 2 年之前
父節點
當前提交
07b8b030ea
共有 1 個文件被更改,包括 13 次插入10 次删除
  1. 13 10
      src/main/frontend/util/text.cljs

+ 13 - 10
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)))))