Fix UpdateHandler crash when replace.content is a rich-text object
OwnYourSwarm sends content as an array of objects with `value` and `html` keys per the Micropub spec. The handler now handles both forms: plain strings and rich objects, preferring `html` over `value`. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
4451fc247e
commit
e8e2bff5e4
2 changed files with 24 additions and 1 deletions
|
|
@ -538,6 +538,29 @@ class MicropubControllerTest extends TestCase
|
|||
$this->assertSame('replaced content', $note->content);
|
||||
}
|
||||
|
||||
#[Test]
|
||||
public function micropub_client_api_request_updates_existing_note_with_rich_text_content(): void
|
||||
{
|
||||
$note = Note::factory()->create();
|
||||
$response = $this->postJson(
|
||||
'/api/post',
|
||||
[
|
||||
'action' => 'update',
|
||||
'url' => $note->uri,
|
||||
'replace' => [
|
||||
'content' => [['value' => 'plain text', 'html' => 'html version']],
|
||||
],
|
||||
],
|
||||
['HTTP_Authorization' => 'Bearer ' . $this->getToken()]
|
||||
);
|
||||
$response
|
||||
->assertJson(['response' => 'updated'])
|
||||
->assertSuccessful();
|
||||
|
||||
$note->refresh();
|
||||
$this->assertSame('html version', $note->content);
|
||||
}
|
||||
|
||||
#[Test]
|
||||
public function micropub_client_api_request_updates_note_syndication_links(): void
|
||||
{
|
||||
|
|
|
|||
Loading…
Reference in a new issue