fix: resolve internal content urls by path, not by string

A backup holding a PDF attachment could not be imported back: legacy links
carry a cache-buster (".../files/m1/doc.pdf?v=1783170649"), and the resolver
compared the raw tail with its sanitized form, so the query made the name
differ from itself. The reference then read as internal by prefix and
non-canonical by name, which is exactly the combination _content_state must
refuse — every such document failed with invalid_content.

Parse the url as a url: the path addresses the file, the query and the
fragment address the transfer. Path segments keep doing the guarding, so
dropping the query cannot widen what a segment is allowed to be.

Issue: #225
User-Visible: yes
This commit is contained in:
Codex
2026-08-20 22:00:22 +03:00
parent a0716dc404
commit 4a84734b18
4 changed files with 148 additions and 0 deletions
+5
View File
@@ -7,6 +7,11 @@
contains only the remaining active visible entities and disappears when
none remain; two explicitly placed entity/device markers still coexist
([#226](https://github.com/Matysh/houseplan-card/issues/226)).
- Fixed a backup with PDF attachments refusing to import back with "The backup
contains invalid or inconsistent content references". Attachment links that
carry a cache-buster (`…/files/marker/doc.pdf?v=1783170649`) are now resolved
by their path, as a URL rather than as a string
([#225](https://github.com/Matysh/houseplan-card/issues/225)).
## v1.66.0 — 2026-08-20
+5
View File
@@ -14,6 +14,11 @@
пустом остатке он исчезает; две явно размещённые привязки entity/device
по-прежнему могут сосуществовать
([#226](https://github.com/Matysh/houseplan-card/issues/226)).
- Исправлено: резервная копия с прикреплёнными PDF отказывалась импортироваться
обратно с сообщением «Резервная копия содержит некорректные или
несогласованные ссылки на файлы». Ссылки на вложения с кэш-бастером
(`…/files/маркер/doc.pdf?v=1783170649`) теперь разбираются по пути — как URL,
а не как строка ([#225](https://github.com/Matysh/houseplan-card/issues/225)).
## v1.66.0 — 2026-08-20