Skip to content

fix: migrate image assets as Node embeds instead of page-refs - #12915

Open
ll1zt wants to merge 1 commit into
logseq:masterfrom
ll1zt:fix/migrate-assets-as-node-embed
Open

ll1zt wants to merge 1 commit into
logseq:masterfrom
ll1zt:fix/migrate-assets-as-node-embed

Conversation

@ll1zt

@ll1zt ll1zt commented Jul 16, 2026 •

Copy link
Copy Markdown

Description

internal issue: Asset migration / publish problems in DB graphs

Problem

After File-based (OG) → DB graph migration:

  • Image blocks were rewritten to [[asset-uuid]] page references in :block/title.
  • Asset entities were still created correctly (:logseq.class/Asset, checksum, etc.).
  • Online Publish (collect-embedded-blocks) and some rendering paths only follow :block/link (Node embed) to pull full Asset datoms into the payload.
  • Result: Migrated images showed locally but were missing ("未发布") after publish/sync.

Solution

In deps/graph-parser/src/logseq/graph_parser/exporter.cljs:

  • Pure single-image blocks → Convert the entire block to a Node embed (:block/title "", :block/link [:block/uuid asset-uuid]).
  • Mixed text + image(s) or multi-image blocks → Strip image markdown links from parent title, keep non-image links as [[uuid]], and insert child/sibling embed blocks for each image.
  • Non-image assets (PDFs, etc.) continue using the legacy [[uuid]] path.
  • Guard handle-embeds to avoid colliding with existing :block/link.
  • Fixed embed block tx construction so :block/page uses the final resolved uuid (avoids lookup-ref uniqueness error during import).

Updated tests (unit + integration) to verify new embed behavior.

Key Changes

- update block title to [[uuid]]
+ pure image → :block/link Node embed
+ mixed → strip image markdown + child embed blocks

File→DB import previously rewrote image markdown to [[asset-uuid]] page
refs. Publish collects assets via :block/link (collect-embedded-blocks),
so those migrated images were missing from published payloads.

Convert pure image blocks to empty-title Node embeds, and mixed/multi
image blocks to child embeds while keeping non-image asset links as
[[uuid]] page-refs.
@CLAassistant

CLAassistant commented Jul 16, 2026 •

Copy link
Copy Markdown

CLA assistant check
All committers have signed the CLA.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants