Skip to content

Commit 5c27b47

Browse files
committed
fix: wrong :block/title data
1 parent 7c0e5b5 commit 5c27b47

File tree

1 file changed

+20
-18
lines changed

1 file changed

+20
-18
lines changed

src/main/frontend/worker/db/migrate.cljs

+20-18
Original file line numberDiff line numberDiff line change
@@ -401,24 +401,26 @@
401401
datoms (d/datoms db :avet :block/title)]
402402
(keep
403403
(fn [{:keys [e v]}]
404-
(when (string/includes? v ref-special-chars)
405-
(let [entity (d/entity db e)]
406-
(cond
407-
(and (ldb/page? entity)
408-
(re-find db-content/id-ref-pattern v))
409-
[:db/retractEntity e]
410-
411-
(string/includes? v (str page-ref/left-brackets ref-special-chars))
412-
(let [title' (string/replace v (str page-ref/left-brackets ref-special-chars) page-ref/left-brackets)]
413-
(prn :debug {:old-title v :new-title title'})
414-
{:db/id e
415-
:block/title title'})
416-
417-
(re-find id-ref-pattern v)
418-
(let [title' (string/replace v id-ref-pattern "$1")]
419-
(prn :debug {:old-title v :new-title title'})
420-
{:db/id e
421-
:block/title title'})))))
404+
(if (string? v)
405+
(when (string/includes? v ref-special-chars)
406+
(let [entity (d/entity db e)]
407+
(cond
408+
(and (ldb/page? entity)
409+
(re-find db-content/id-ref-pattern v))
410+
[:db/retractEntity e]
411+
412+
(string/includes? v (str page-ref/left-brackets ref-special-chars))
413+
(let [title' (string/replace v (str page-ref/left-brackets ref-special-chars) page-ref/left-brackets)]
414+
(prn :debug {:old-title v :new-title title'})
415+
{:db/id e
416+
:block/title title'})
417+
418+
(re-find id-ref-pattern v)
419+
(let [title' (string/replace v id-ref-pattern "$1")]
420+
(prn :debug {:old-title v :new-title title'})
421+
{:db/id e
422+
:block/title title'}))))
423+
[:db/retractEntity e]))
422424
datoms)))
423425

424426
(defn- replace-block-type-with-tags

0 commit comments

Comments
 (0)