Commit bbffdaa
fix(favorite): avoid 500 when unfavoriting a note with no tags left (#554)
removeFromFavorites() can leave a note with no tags, in which case
getTagsForObjects([$id]) returns an array without the $id key. Reading
$tags[$id] then yields null, and in_array() throws a TypeError, so the
PUT .../favorite request returns HTTP 500 even though the state change
was already persisted.
Guard the lookup with array_key_exists(), matching the defensive pattern
already used in getAll() and getTags().
Fixes #553
Signed-off-by: Thomas Müller <1005065+DeepDiver1975@users.noreply.github.com>
Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>1 parent c393cca commit bbffdaa
2 files changed
Lines changed: 7 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
7 | 7 | | |
8 | 8 | | |
9 | 9 | | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
10 | 15 | | |
11 | 16 | | |
12 | 17 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
181 | 181 | | |
182 | 182 | | |
183 | 183 | | |
184 | | - | |
| 184 | + | |
| 185 | + | |
185 | 186 | | |
186 | 187 | | |
187 | 188 | | |
| |||
0 commit comments