Triple-T / gradle-play-publisher

GPP is Android's unofficial release automation Gradle Plugin. It can do anything from building, uploading, and then promoting your App Bundle or APK to publishing app listings and other metadata.
MIT License
4.1k stars 340 forks source link

Boostrap downloads JPEG files with incorrect .png file extension #992

Closed rtsisyk closed 2 years ago

rtsisyk commented 3 years ago

Describe the bug

A clear and concise description of what the bug is.

How To Reproduce

./gradlew bootstrapGoogleRelease
file -b src/google/play/listings/en-US/graphics/phone-screenshots/1.png
JPEG image data, Exif standard: [TIFF image data, big-endian, direntries=5, height=3040, software=Android RP1A.200720.012.G973FXXUAFUE3, orientation=[*0*], width=1440], baseline, precision 8, 1440x3040, components 3

All JPEG screenshots downloaded as .png.

Versions

+--- com.github.triplet.gradle:play-publisher:3.4.0
|    +--- com.github.triplet.gradle:android-publisher:3.4.0
|    |    +--- com.github.triplet.gradle:common-utils:3.4.0
|    +--- com.github.triplet.gradle:common-utils:3.4.0
|    +--- com.github.triplet.gradle:common-validation:3.4.0
Gradle 7.0
+--- com.android.tools.build:gradle:4.1.3

Tasks executed

bootstrap.

Expected behavior

JPEG files downloaded with .jpg extension instead of .png.

biodranik commented 3 years ago

Looks like this line causes the error https://github.com/Triple-T/gradle-play-publisher/blob/ae69e86dc7c5bf561dd719090cb31cd6d3519d7a/play/plugin/src/main/kotlin/com/github/triplet/gradle/play/tasks/Bootstrap.kt#L160

SUPERCILEX commented 3 years ago

Yeah, the logic is pretty dumb as you've noticed. :) I'll have to see if the API tells us what the image type is. If not, I guess we can just read the first few bytes of the file and check it against the magic numbers: https://en.wikipedia.org/wiki/List_of_file_signatures

rtsisyk commented 2 years ago

Thanks a lot!

On Mon, 20 Sep 2021, 05:29 Alex Saveau, @.***> wrote:

Closed #992 https://github.com/Triple-T/gradle-play-publisher/issues/992 via 1de6e41 https://github.com/Triple-T/gradle-play-publisher/commit/1de6e419b306c930e321ba8ec3fe917572ed2da7 .

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/Triple-T/gradle-play-publisher/issues/992#event-5325652151, or unsubscribe https://github.com/notifications/unsubscribe-auth/AANXHDVXEB444B4CPDIHGTTUC2L7RANCNFSM5BZMDW4Q .