Edit message (PATCH) endpoint does not allow for partial modifications without affecting embeds

(#606) Bug Awaiting confirmation api embeds

Summary

Despite the fact that a PATCH HTTP method should apply partial modification to a resource, using the `PATCH /channels/{channel.id}/messages/{message.id}` endpoint with only "content" field results in both the message content and embeds being fully replaced by the given payload, i.e. it affects fields that weren't provided. This is unexpected for a PATCH endpoint (+ it differs from Discord's behaviour of the same endpoint). I'd only expect embeds to be removed, if "embeds": [] was included in the payload. The same problem does not seem to appear, when doing the opposite - I can edit only embeds without the content being removed. NOTE: This is a repost of #280 - I can still reproduce the issue after Fluxer V2 release.

Steps to reproduce

  1. Send the following message to the channel (`POST
/channels/{channel.id}/messages`)
{"content": "Test", "embeds": [{"description": "text"}]}
  1. See that it has content and an embed:image
  2. Edit the message created in step 1 (`PATCH
/channels/{channel.id}/messages/{message.id}`)
{"content": "edit"}
  1. See that it no longer has an embed:image
--- Note that the same issue does not occur, if instead of editing content, you were to modify the embed with the following payload in step 3:
{"embeds": [{"description": "edit"}]}
The content remains: image (side note: there's no "(edited)" indicator in such a case)

Environment

This is an API issue, so not relevant.

Logs or screenshots

Already posted above
  • 553272605-80535073-9c38-4138-a8d5-c70d811e69ec.png

    553272605-80535073-9c38-4138-a8d5-c70d811e69ec.png

    370×143 | 11 kB

  • 553272705-439da8b1-0e47-4d5a-81c1-c4511e5f8489.png

    553272705-439da8b1-0e47-4d5a-81c1-c4511e5f8489.png

    351×86 | 11 kB

  • 553273508-c1b727cd-8c63-4a80-9471-4e16f3bcfceb.png

    553273508-c1b727cd-8c63-4a80-9471-4e16f3bcfceb.png

    355×151 | 12 kB

Merged posts

These posts were merged into this one. Their comments are now part of the conversation below, marked with where they came from.

Report details

Summary

Despite the fact that a PATCH HTTP method should apply partial modification to a resource, using the `PATCH /channels/{channel.id}/messages/{message.id}` endpoint with only "content" field results in both the message content and embeds being fully replaced by the given payload, i.e. it affects fields that weren't provided. This is unexpected for a PATCH endpoint (+ it differs from Discord's behaviour of the same endpoint). I'd only expect embeds to be removed, if "embeds": [] was included in the payload. The same problem does not seem to appear, when doing the opposite - I can edit only embeds without the content being removed.

Steps to reproduce

  1. Send the following message to the channel (`POST
/channels/{channel.id}/messages`)
{"content": "Test", "embeds": [{"description": "text"}]}
  1. See that it has content and an embed:image
  2. Edit the message created in step 1 (`PATCH
/channels/{channel.id}/messages/{message.id}`)
{"content": "edit"}
  1. See that it no longer has an embed:image
--- Note that the same issue does not occur, if instead of editing content, you were to modify the embed with the following payload in step 3:
{"embeds": [{"description": "edit"}]}
The content remains: image (side note: there's no "(edited)" indicator in such a case)
  • 553272605-80535073-9c38-4138-a8d5-c70d811e69ec.png

    553272605-80535073-9c38-4138-a8d5-c70d811e69ec.png

    370×143 | 11 kB

  • 553272705-439da8b1-0e47-4d5a-81c1-c4511e5f8489.png

    553272705-439da8b1-0e47-4d5a-81c1-c4511e5f8489.png

    351×86 | 11 kB

  • 553273508-c1b727cd-8c63-4a80-9471-4e16f3bcfceb.png

    553273508-c1b727cd-8c63-4a80-9471-4e16f3bcfceb.png

    355×151 | 12 kB

4 comments

Sign in with Fluxer to comment and vote.
Comment by Rex
RexSystem 1 vote
Status changed from Fixed to Awaiting confirmation
This was closed in a bulk cleanup before Fluxer V2 without being checked or fixed. It may work now, so it is waiting for someone to confirm whether the bug still happens.
Comment by @Jackenmen
RexSystem 1 vote Merged from #280 originally by @Jackenmen on GitHub OP
I've also noticed that the loss of edited indicator is cause edited_timestamp gets set to None on such message edits.