Skip to content

PATCHing with CV2 breaks media uploads #7529

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
VelvetToroyashi opened this issue Apr 28, 2025 · 1 comment
Open

PATCHing with CV2 breaks media uploads #7529

VelvetToroyashi opened this issue Apr 28, 2025 · 1 comment
Labels

Comments

@VelvetToroyashi
Copy link
Contributor

Description

As it stands right now, attempting to defer or otherwise edit a media gallery into a message throws a 400 and claims the unfurled media attachment is not found

This also happens when attempting to use the legacy followup as an edit method, but does not occur when using a direct response or a separate followup

Steps to Reproduce

As some psudocode of what does and does not work:

// Assume that 'builder' contains the following:
// 1 file (`image.png`)
// 1 Media gallery & item referenced via `attachment://image.png`

// Does NOT work; undocumented behavior for followup = patch
await interaction.DeferAsync();
await interaction.FollowupAsync(builder); // 400

// Does NOT work (expected behavior: message is edited and media gallery is shown
await interaction.RespondAsync(new TextDisplayComponent("Hello!")); 
await interaction.EditOriginalResponseAsync(builder); // 400! Happens even when initial response is cv2

// DOES work as expected
await interaction.RespondAsync(builder); // Initial response

// DOES work as expected
await interaction.CreateResponseAsync(new TextDisplayComponent("Hello!"));
await interaction.FollowupAsync(builder); // Seperate response; attachment is posted as expected

This appears to be specific to media galleries as uploading attachments normally works fine

Expected Behavior

The media gallery appears as normal

Current Behavior

The following 400 is returned

{"components":{"0":{"items":{"0":{"media":{"url":{"_errors":[{"code":"UNFURLED_MEDIA_ITEM_REFERENCED_ATTACHMENT_NOT_FOUND","message":"The referenced attachment (\u0022attachment://image.webp\u0022) was not found"}]}}}}}}}

Screenshots/Videos

No response

Client and System Information

N/A; API V10

@freya022
Copy link

freya022 commented Apr 30, 2025

This issue also happens for messages sent via channels, I can reproduce it when the attachments field is absent from the PATCH request, sending even an empty array is enough to fix the issue.

The documentation says "only files listed in the attachments parameter will be appended to the message", but as I said, there is no issue sending an empty array while still having the attachments in the form data

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants