From 295d9568c8bc203bcdc97b0bf1333d0b19195712 Mon Sep 17 00:00:00 2001 From: Andrey Antukh Date: Mon, 29 Jan 2024 15:25:27 +0100 Subject: [PATCH] :bug: Fix incompatibilities of old file migrations with new code --- common/src/app/common/files/migrations.cljc | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/common/src/app/common/files/migrations.cljc b/common/src/app/common/files/migrations.cljc index 49e37e0b77..774a71717f 100644 --- a/common/src/app/common/files/migrations.cljc +++ b/common/src/app/common/files/migrations.cljc @@ -109,11 +109,14 @@ (assoc :points (grc/rect->points selrect)))))) (fix-empty-points [shape] - (let [shape (cond-> shape - (empty? (:selrect shape)) (cts/setup-rect))] - (cond-> shape - (empty? (:points shape)) - (assoc :points (grc/rect->points (:selrect shape)))))) + (if (empty? (:points shape)) + (-> shape + (update :selrect (fn [selrect] + (if (map? selrect) + (grc/make-rect selrect) + selrect))) + (cts/setup-shape)) + shape)) (update-object [object] (cond-> object @@ -857,4 +860,4 @@ (update-container [container] (d/update-when container :objects update-vals fix-shape))] (-> data - (update :pages-index update-vals update-container)))) \ No newline at end of file + (update :pages-index update-vals update-container))))