ReVanced / revanced-patches

🧩 Patches for ReVanced
https://revanced.app
GNU General Public License v3.0
2.43k stars 282 forks source link

bug(TikTok - Downloads): 'Remove watermark' patch corrupts downloaded images #2718

Open SpoonThief opened 9 months ago

SpoonThief commented 9 months ago

Bug description

The Downloads patch for tiktok is downloading corrupted image files. Image downloads work correctly in unpatched 32.5.3 and a patched 32.5.3 without the Downloads patch.

Videos still download normally in all versions, although when selecting the directory in the revanced settings, I do get an error at the bottom of the screen. Error-Screenshot

The corrupted images still show a thumbnail in my phone's file explorer, but I cannot open the image on my phone or any other device. Windows, for example doesn't even show a thumbnail and says the file is corrupt. I have included an example of one of these corrupted PNGs: corrupt_png_file

Error logs

No response

Solution

No response

Additional context

No response

Acknowledgements

LisoUseInAIKyrios commented 8 months ago

The download directory error is an oversight from some recent refactoring.

Have you previously used the download patch? Did it ever work correctly to download images?

SpoonThief commented 8 months ago

The download patch worked correctly for months, I first noticed the issue maybe a few weeks ago on a previously patched version, and updated to the newest recommended version and the issue persisted.

LisoUseInAIKyrios commented 8 months ago

Are the images still corrupt if 'remove watermark' is turned on or off?

SpoonThief commented 8 months ago

It looks like it's the 'remove watermark' option that's causing the issue. It works successfully with videos, but whatever magic under the hood it does for images is borked.

lbux commented 6 months ago

Downloading images without them being corrupted has always worked for me on the most recent recommended version (32.5.3) up until yesterday. Now all images are being corrupted. Some apps can read the images (Google photos, instagram) while some can not (discord)

lbux commented 6 months ago

Not sure why my previous comment was marked as spam.

Anyway, further looking into it, the files are being downloaded as HEIC. If you rename the file to HEIC, some applications will accept it (those that support HEIC). If you look at the hex code, the first coupleof bytes will show ftypeheic instead of png. Opening up the file with Exiftool confirms it was encoded as HEIC

image

LisoUseInAIKyrios commented 6 months ago

Are all images downloaded as heic?

In other words, does renaming the downloaded file to the correct extension name fix this issue?

lbux commented 6 months ago

Are all images downloaded as heic?

All images with the "disable watermark" option are saved as HEIC.

If you use an unpatched up to date TikTok, it saves images as WebP.

If you patch TikTok (32.5.3) but disable the "disable watermark" option, it saves it as WebP as well.

Whether the extension is correct (renaming it to HEIC) does help a bit when apps determine how to open a file based on extension name, but most are able to read the image data to determine what type it is in case extensions are wrong. The biggest issue is that there is a lack of HEIC support due to licensing.