discord-rich-presence-plex icon indicating copy to clipboard operation
discord-rich-presence-plex copied to clipboard

"File type invalid (1)" on upload to imgur with some albums

Open Jabster28 opened this issue 2 years ago • 2 comments

With certain albums, the upload will fail:

[21-05-2022 07:28:34 PM] [DEBUG] [server/7D018] Uploading image
[21-05-2022 07:28:35 PM] [ERROR] An unexpected error occured while uploading an image
Traceback (most recent call last):
  File "/Users/me/discord-rich-presence-plex/services/imgur.py", line 15, in uploadImage
    raise Exception(data["data"]["error"])

I'm guessing this is because the album image isn't in the format that imgur wants, but I'm not sure how the upload system works.

Jabster28 avatar May 21 '22 18:05 Jabster28

Add the below line in services/imgur.py after line 7 and let me know what it outputs:

logger.debug(requests.head(url).headers["content-type"])

phin05 avatar May 21 '22 19:05 phin05

[24-05-2022 07:59:55 PM] [DEBUG] [server/8996D] Uploading image
[24-05-2022 07:59:55 PM] [DEBUG] image/jpeg
[24-05-2022 07:59:56 PM] [ERROR] An unexpected error occured while uploading an image
Traceback (most recent call last):
  File "/Users/me/discord-rich-presence-plex/services/imgur.py", line 16, in uploadImage
    raise Exception(data["data"]["error"])
Exception: {'code': 1003, 'message': 'File type invalid (1)', 'type': 'ImgurException', 'exception': []}

hmm, i'd assume it'd accept jpegs right?

Jabster28 avatar May 24 '22 19:05 Jabster28

This should be fixed in v2.4.2. Images supported by Pillow will be converted to plain JPEG before being uploaded.

hmm, i'd assume it'd accept jpegs right?

It should, but maybe the source image's content-type header is incorrect and the image is actually in a format not supported by Imgur.

phin05 avatar Nov 05 '23 10:11 phin05