Skip to content

Animated WebP-uploaded assets result in a HTTP 415 error when downloading from JDA's generated URLs #2999

@freya022

Description

@freya022

General Troubleshooting

  • I have checked for similar issues on the Issue-tracker.
  • I have checked for PRs that might already address this issue.

Version of JDA

6.2.1

Expected Behaviour

There should be a way for an user to choose the format in which the asset's URL will point to. This should also be available for methods that create ImageProxy(s)

One way would be to define a class that holds the extension as well as query parameters, then create constants for the common formats, such as PNG, GIF, WebP and Animated WebP.

This way, the user can, based on what they can handle, choose which format to request.

Conversion support varies:

  • The CDN does not support AVIF requests
  • Requesting as JPG, PNG or static WebP seems to be well supported
  • Animated WebP -> GIF is unsupported, converting to static formats (JPG, PNG, WebP) still is supported

Discord recommends loading animated assets as WebP, but as tooling support is sparse, we can't force that upon users.

Code Example for Reproduction Steps

// A custom emoji uploaded from an *animated WebP*
CustomEmoji emoji = Emoji.fromCustom("disintegrate", 1459527650296074323L, true);

// Throws HTTP 415 as JDA attempts to download as GIF
emoji.getImage().download().get();

Code for JDABuilder or DefaultShardManagerBuilder used

No JDA instance is required

Exception or Error

java.util.concurrent.CompletionException: net.dv8tion.jda.api.exceptions.HttpException: 415:
        at java.base/java.util.concurrent.CompletableFuture.wrapInCompletionException(CompletableFuture.java:325)
        at java.base/java.util.concurrent.CompletableFuture.encodeThrowable(CompletableFuture.java:378)
        at java.base/java.util.concurrent.CompletableFuture.completeThrowable(CompletableFuture.java:393)
        at java.base/java.util.concurrent.CompletableFuture$UniAccept.tryFire(CompletableFuture.java:754)
        at java.base/java.util.concurrent.CompletableFuture.postComplete(CompletableFuture.java:556)
        at java.base/java.util.concurrent.CompletableFuture.completeExceptionally(CompletableFuture.java:2246)
        at net.dv8tion.jda.api.utils.FileProxy.lambda$downloadInternal$1(FileProxy.java:175)

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions