From 8dd6c7abe6348e60d49eed5d5894333082820d56 Mon Sep 17 00:00:00 2001 From: LinYu Date: Fri, 4 Sep 2026 09:17:02 +0800 Subject: [PATCH] fix(markdown): resolve media links in the rehype ast Media in a markdown file was handled by two string/DOM hacks stacked on each other: a regex on the raw source rewrote relative urls into `${api}/d/...`, and a post-render pass parsed that link back into a storage path to look up a signed raw url. Both directions were heuristics, and the second one made every media element fire a request that was expected to fail. Move the structural work into a rehype plugin that runs after `rehype-raw` and before `rehype-sanitize`: - resolve every media url to a storage path once, then build the link with getLinkByDirAndObj(), so the share prefix (/sd + pwd), the sign and path encoding match the rest of the app; the sign of a sibling is already in the folder listing, which costs no extra request - replace an whose target is a video with a