From db40f40650ab498b3c4669503800214827e623c0 Mon Sep 17 00:00:00 2001 From: JeffreyCA Date: Tue, 27 Feb 2024 19:27:07 -0800 Subject: [PATCH] Fix issue with Imgur uploads consistently failing --- CHANGELOG.md | 5 +++++ Tweak.xm | 5 +++++ control | 2 +- 3 files changed, 11 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 42226be..06cfb34 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,10 @@ All notable changes to this project will be documented in this file. +## [v1.0.11] - 2024-02-27 + +Fix issue with Imgur uploads consistently failing. Note that multi-image uploads may still fail on the first attempt. + ## [v1.0.10] - 2024-01-22 Add support for /u/ share links (e.g. `reddit.com/u/username/s/xxxxxx`). @@ -50,6 +54,7 @@ There are currently a few limitations: ## [v1.0.0] - 2023-10-13 - Initial release +[v1.0.11]: https://github.com/JeffreyCA/Apollo-ImprovedCustomApi/compare/v1.0.10...v1.0.11 [v1.0.10]: https://github.com/JeffreyCA/Apollo-ImprovedCustomApi/compare/v1.0.9...v1.0.10 [v1.0.9]: https://github.com/JeffreyCA/Apollo-ImprovedCustomApi/compare/v1.0.8...v1.0.9 [v1.0.8]: https://github.com/JeffreyCA/Apollo-ImprovedCustomApi/compare/v1.0.7...v1.0.8 diff --git a/Tweak.xm b/Tweak.xm index 909b339..0268328 100644 --- a/Tweak.xm +++ b/Tweak.xm @@ -545,6 +545,11 @@ static NSString *imageID; NSMutableURLRequest *mutableRequest = [request mutableCopy]; // Insert the api credential and update the request on this session task [mutableRequest setValue:[NSString stringWithFormat:@"Client-ID %@", sImgurClientId] forHTTPHeaderField:@"Authorization"]; + // Set or else upload will fail with 400 + if ([requestURL isEqualToString:@"https://api.imgur.com/3/image"]) { + [mutableRequest setValue:@"image/jpeg" forHTTPHeaderField:@"Content-Type"]; + } + [self setValue:mutableRequest forKey:@"_originalRequest"]; [self setValue:mutableRequest forKey:@"_currentRequest"]; } diff --git a/control b/control index 5d5e4b1..2b81220 100644 --- a/control +++ b/control @@ -1,6 +1,6 @@ Package: ca.jeffrey.apollo-improvedcustomapi Name: Apollo-ImprovedCustomApi -Version: 1.0.10 +Version: 1.0.11 Architecture: iphoneos-arm Description: Apollo for Reddit tweak with in-app configurable API keys Maintainer: JeffreyCA