Skip to content

DB desktop: percent-encoded spaces in local image URLs are encoded twice and fail to render #1386

Closed

Description

@tiensonqin

Search first

  • Searched open/closed db-test reports and related Logseq PRs

What happened?

An inline Markdown image using a valid file:/// URL with %20 for spaces shows a broken image. The same PNG renders when the spaces are literal, both as an absolute path and as a file URL.

This is present on current master including merged logseq/logseq#13552. I have not compared the preceding revision, so this is not a claim that the PR introduced the problem.

Reproduce

  1. Use a disposable local DB graph in Electron. Put a valid PNG in a directory and filename containing spaces. The exact tested file was:
    /workspace/shared/logseq-qa/fixtures/path spaces/qa image.png
    (180 × 180 PNG, 5,107 bytes; any local PNG can be used with the path adjusted.)
  2. Create a normal page and type this into a new ordinary block:
    ![QA path](file:///workspace/shared/logseq-qa/fixtures/path%20spaces/qa%20image.png)
  3. Press Escape to save and leave editing. The block displays a broken image / fallback label.
  4. Add these two blocks pointing to the same file:
    ![QA spaces](/workspace/shared/logseq-qa/fixtures/path spaces/qa image.png)
    ![QA file raw](file:///workspace/shared/logseq-qa/fixtures/path spaces/qa image.png)
  5. Both literal-space controls render the image.
  6. Reload with Ctrl+R, navigate away/back, and reopen the page after an Electron relaunch. The encoded URL remains broken; both controls still render.

Expected

Percent-encoded spaces in a file URL resolve to the same existing local file as the literal-space controls, rather than becoming literal percent characters in the filename.

Actual / frequency

  • 2/2 independently entered encoded-URL blocks on two newly created pages failed in the same disposable graph
  • The first fixture also remained broken after reload and a full Electron relaunch/rebuild at the same SHA
  • Both literal-space controls rendered, including after reload/relaunch
  • A separate absolute-path PNG without spaces rendered
  • File contents remained unchanged; no data-loss claim

Supporting runtime evidence

A read-only renderer inspection after the UI reproduction at 2026-10-01 14:35:48 UTC showed:

Input DOM src attribute natural size
encoded file URL assets:///workspace/shared/logseq-qa/fixtures/path%2520spaces/qa%2520image.png 0 × 0
literal-space absolute path assets:///workspace/shared/logseq-qa/fixtures/path%20spaces/qa%20image.png 180 × 180
literal-space file URL same single-encoded %20 URL 180 × 180

All images had complete=true. The exact file's SHA-256 is 0ac46d1e0bc2a0ff3d791c9f3ddcd3b084e27a6e26dd57fbb182cfbbf8c4225f.

Likely source path, not a tested fix: mldoc preserves %20 in the file link; string-of-url returns its path without the file scheme; file-path->assets-url then treats the already escaped path as a native path and encodes % again. The actual rendered %2520 above supports this explanation.

Related reports checked

  • db-test#1231 / open logseq/logseq#13321: Chromium-rewritten assets URL / missing-slash warning. That warning also occurs for the passing controls here; it is not the failure criterion for this report
  • db-test#665: relative asset references, different input
  • db-test#482: historical Windows drive file-link handling
  • Merged #13552's local-image work and reviews checked; no exact percent-double-encoding case found

Platform

  • Debian GNU/Linux 13, x86_64
  • Logseq DB 2.0.1, development Electron app
  • Exact master SHA: 8ffbb220938acc00e1c70e8579e7c52ab97c2aa7
  • Live renderer and Node worker both verified 8ffbb22; retest build 2026-10-01T14:32:34Z
  • Electron 42.3.0 / Chromium 148.0.7778.180
  • Disposable local DB graph, no authenticated sync
  • Web app untested: this environment's cloud-browser route to the local dev server was blocked by the client

Activity

  1. yuxi-liu-wired commented on Oct 28, 2026

    @yuxi-liu-wired

    Fixed in logseq/logseq#13897 (fix: file:// image paths, #alias of a tag, Validate graph report, PDF viewer after reload). Its description has the cause and the test that pins it; it fails on current master and passes with the fix.

  2. added 4 commits that reference this issue on Oct 29, 2026
    c7e6188
    3ea57b5
    f7c4ff7
    6902318
  3. added 8 commits that reference this issue on Nov 11, 2026
    c441f2a
    c2b7d40
    8a9c56f
    c671168
    dd2c520
    0c8511f
    aea8105
    3e3802f
  4. 1 remaining item

  5. added 8 commits that reference this issue on Nov 17, 2026
    0704f62
    55e417a
    c56a092
    78fe0f9
    e42d238
    4da01bf
    8ba40a7
    97e94ee
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions