Commit d88d1f2
committed
Fix(assets): every device links an attached file the same way
Attaching or dropping a file wrote a different link depending on which
surface you did it from. Paste, and an existing asset dragged in from the
sidebar, embedded a vault-relative wikilink; a drop wrote a markdown link
with a path relative to the note, ``, and the
self-hosted server produced that same note-relative form for the web
client. The mobile apps had a third answer again. Same file, same folder,
three different links.
The note-relative form was also wrong, not merely different: nothing
rewrites relative asset paths when a note moves, so `../assets/pic.png`
broke the moment the note changed depth.
So there is now one rule, everywhere: the file lands in `assets/` and is
linked by VAULT-relative path, an image as `![[assets/pic.png]]` and
anything else as `[name](<assets/report.pdf>)`. That is what paste and
the sidebar drag already wrote, so this moves the odd routes onto the
form the app already used most.
Existing notes are unaffected: resolveAssetVaultRelativePath tries
note-relative, then vault-root, then a unique basename, so both the old
and the new form keep resolving on both rendering surfaces.
`ImportAsset` no longer reads notePath, since where the note lives can no
longer change what is written; it stays in the signature because the
handler and clients still send it. The matching mobile fixes ship in the
zennotesandroid and zennotesios repos.
Claude-Session: https://claude.ai/code/session_01AYTRixg5TJmxn2j6FCqfUD1 parent 2f71229 commit d88d1f2
4 files changed
Lines changed: 64 additions & 35 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
442 | 442 | | |
443 | 443 | | |
444 | 444 | | |
445 | | - | |
| 445 | + | |
446 | 446 | | |
447 | 447 | | |
448 | 448 | | |
| |||
452 | 452 | | |
453 | 453 | | |
454 | 454 | | |
455 | | - | |
456 | | - | |
| 455 | + | |
| 456 | + | |
| 457 | + | |
457 | 458 | | |
458 | 459 | | |
459 | 460 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3405 | 3405 | | |
3406 | 3406 | | |
3407 | 3407 | | |
| 3408 | + | |
| 3409 | + | |
| 3410 | + | |
| 3411 | + | |
| 3412 | + | |
| 3413 | + | |
| 3414 | + | |
| 3415 | + | |
| 3416 | + | |
| 3417 | + | |
| 3418 | + | |
| 3419 | + | |
| 3420 | + | |
| 3421 | + | |
3408 | 3422 | | |
3409 | | - | |
| 3423 | + | |
3410 | 3424 | | |
3411 | 3425 | | |
3412 | 3426 | | |
3413 | | - | |
3414 | | - | |
3415 | | - | |
3416 | | - | |
3417 | | - | |
| 3427 | + | |
| 3428 | + | |
3418 | 3429 | | |
3419 | 3430 | | |
3420 | 3431 | | |
| |||
4261 | 4272 | | |
4262 | 4273 | | |
4263 | 4274 | | |
4264 | | - | |
4265 | 4275 | | |
4266 | 4276 | | |
4267 | 4277 | | |
| |||
4280 | 4290 | | |
4281 | 4291 | | |
4282 | 4292 | | |
4283 | | - | |
4284 | | - | |
4285 | | - | |
4286 | | - | |
4287 | 4293 | | |
4288 | 4294 | | |
4289 | 4295 | | |
4290 | 4296 | | |
4291 | | - | |
| 4297 | + | |
4292 | 4298 | | |
4293 | 4299 | | |
4294 | 4300 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2521 | 2521 | | |
2522 | 2522 | | |
2523 | 2523 | | |
| 2524 | + | |
| 2525 | + | |
| 2526 | + | |
2524 | 2527 | | |
| 2528 | + | |
2525 | 2529 | | |
2526 | 2530 | | |
2527 | 2531 | | |
| |||
2562 | 2566 | | |
2563 | 2567 | | |
2564 | 2568 | | |
2565 | | - | |
2566 | | - | |
2567 | | - | |
2568 | | - | |
2569 | | - | |
2570 | | - | |
2571 | | - | |
2572 | | - | |
2573 | | - | |
2574 | | - | |
2575 | 2569 | | |
2576 | | - | |
| 2570 | + | |
2577 | 2571 | | |
2578 | 2572 | | |
2579 | 2573 | | |
| |||
2740 | 2734 | | |
2741 | 2735 | | |
2742 | 2736 | | |
2743 | | - | |
2744 | | - | |
2745 | | - | |
2746 | | - | |
2747 | | - | |
2748 | | - | |
2749 | | - | |
| 2737 | + | |
| 2738 | + | |
| 2739 | + | |
| 2740 | + | |
| 2741 | + | |
| 2742 | + | |
| 2743 | + | |
| 2744 | + | |
2750 | 2745 | | |
| 2746 | + | |
| 2747 | + | |
2751 | 2748 | | |
2752 | 2749 | | |
2753 | 2750 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
111 | 111 | | |
112 | 112 | | |
113 | 113 | | |
114 | | - | |
115 | | - | |
| 114 | + | |
| 115 | + | |
116 | 116 | | |
117 | 117 | | |
118 | 118 | | |
119 | 119 | | |
120 | 120 | | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
121 | 146 | | |
122 | 147 | | |
123 | 148 | | |
| |||
0 commit comments