Commit 2e2d0cb
fix: preserve permalink when editing notes without frontmatter permalink
Fixes issue #170 where edit_note would fail with EntityResponse validation error
"Input should be a valid string [type=string_type, input_value=None, input_type=NoneType]"
even though the edit operation succeeded.
Root cause: The entity_model_from_markdown function was unconditionally overwriting
the permalink field with markdown.frontmatter.permalink, even when it was None.
This caused existing entities to lose their permalinks when edited.
Changes:
- Only update permalink from frontmatter if it's not None, preserving existing permalink
- Add regression test to prevent this issue from recurring
The actual edit operation worked fine, but the API response validation failed because
EntityResponse.permalink is required but was being set to None.
Co-authored-by: Paul Hernandez <phernandez@users.noreply.github.com>1 parent 2a3adc1 commit 2e2d0cb
2 files changed
Lines changed: 42 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
38 | 38 | | |
39 | 39 | | |
40 | 40 | | |
41 | | - | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
42 | 44 | | |
43 | 45 | | |
44 | 46 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
359 | 359 | | |
360 | 360 | | |
361 | 361 | | |
| 362 | + | |
| 363 | + | |
| 364 | + | |
| 365 | + | |
| 366 | + | |
| 367 | + | |
| 368 | + | |
| 369 | + | |
| 370 | + | |
| 371 | + | |
| 372 | + | |
| 373 | + | |
| 374 | + | |
| 375 | + | |
| 376 | + | |
| 377 | + | |
| 378 | + | |
| 379 | + | |
| 380 | + | |
| 381 | + | |
| 382 | + | |
| 383 | + | |
| 384 | + | |
| 385 | + | |
| 386 | + | |
| 387 | + | |
| 388 | + | |
| 389 | + | |
| 390 | + | |
| 391 | + | |
| 392 | + | |
| 393 | + | |
| 394 | + | |
| 395 | + | |
| 396 | + | |
| 397 | + | |
| 398 | + | |
| 399 | + | |
| 400 | + | |
0 commit comments