From ccea0ace90c931e14c00ff98d98337716745cfdb Mon Sep 17 00:00:00 2001 From: Gabriel Horner Date: Fri, 27 Mar 2026 14:45:29 -0400 Subject: [PATCH] fix(cli): create page fails with 'page-not-found' Some page names are modified during creation for internal reasons e.g. 'upsert page --page=foo#bar' results in the page 'fooHashTag-bar'. Use uuid from create-page operation for more reliable identification of created pages Also finish fix for 29a7a77a6ba145baec7bb8a57ef7058f38919d28 --- src/main/logseq/cli/command/upsert.cljs | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/src/main/logseq/cli/command/upsert.cljs b/src/main/logseq/cli/command/upsert.cljs index 8dd5cddc3e..c3f852e160 100644 --- a/src/main/logseq/cli/command/upsert.cljs +++ b/src/main/logseq/cli/command/upsert.cljs @@ -353,9 +353,14 @@ (p/let [existing (pull-page-by-name config repo page-name [:db/id :block/uuid])] (if (:db/id existing) existing - (p/let [_ (transport/invoke config :thread-api/apply-outliner-ops false - [repo [[:create-page [page-name {}]]] {}]) - created (pull-page-by-name config repo page-name [:db/id :block/uuid])] + (p/let [result (transport/invoke config :thread-api/apply-outliner-ops false + [repo [[:create-page [page-name {}]]] {}]) + ;; create-page returns [title' page-uuid]; use uuid to find + ;; the page since the stored name may differ from the input + created (if-let [page-uuid (second result)] + (transport/invoke config :thread-api/pull false + [repo [:db/id :block/uuid] [:block/uuid page-uuid]]) + (pull-page-by-name config repo page-name [:db/id :block/uuid]))] (if (:db/id created) created (throw (ex-info "page not found after upsert" @@ -546,10 +551,10 @@ update-tags (add-command/resolve-tags cfg (:repo action) (:update-tags action)) remove-tags (add-command/resolve-tags cfg (:repo action) (:remove-tags action)) update-properties (add-command/resolve-properties cfg (:repo action) (:update-properties action) - {:allow-non-built-in? false}) + {:allow-non-built-in? true}) remove-properties (add-command/resolve-property-identifiers cfg (:repo action) (:remove-properties action) - {:allow-non-built-in? false}) + {:allow-non-built-in? true}) _ (ensure-property-identifiers-exist! cfg (:repo action) (keys (or update-properties {}))) _ (ensure-property-identifiers-exist! cfg (:repo action) remove-properties) update-tag-ids (->> (or update-tags [])