vrtmrz / obsidian-livesync

MIT License
3.96k stars 134 forks source link

File size of synced PDF increases 5x after being synced IOS and iPadOS #308

Open DavidBoettger opened 8 months ago

DavidBoettger commented 8 months ago

Abstract

File size of synced PDF increases 5x after being synced IOS and iPadOS.

Expected behaviour

PDF file size should stay the same

Actually happened

I copied a PDF file to Obsidian on my iPad (file size about 7MB). It synced to my Windows PC without a Problem and the size stayed the same. On my iPhone, the file was also there, but the filesize was alost 40MB. I tried it the other way round and synced the same file from my iPhone to the other devices. On the Windows PC, everything was fine again, but this time the file was alomst 40MB on the iPad. When I upload a file to Obsidian from my Windows PC, both the iPad and iPhone files are almost 40MB.

Reproducing procedure

  1. Add a large PDF to Obsidian from any device and look at the file size of the synced file on an iPhone or an iPad.

Does anyone else experience this bug?

vrtmrz commented 7 months ago

Thank you for opening this issue, and so sorry for missing it a bit! May I ask some?

DavidBoettger commented 7 months ago

Thank you for your reply. To answer your questions:

  1. Yes, the files could be opened in IOS just fine and had exactly the same contents
  2. No, the file size doesn’t change after renaming the file
dlphnkck commented 7 months ago

Hi. Sorry to bother you, it's not a PDF file; it's a TTF file, but I may have experienced a similar phenomenon. However, I don't know if the phenomenon is still reproducible today, as it happened around October 6, 2023.

  1. File format: True Type Font (TTF) file for Excalidraw Handwritten
  2. The original file size is 27,919 KB.
  3. Often, it may occur 5 bytes after synchronization.
  4. However, on October 6, only the TTF file in a specific folder increased from 27,919 KB to 55,837 KB.
  5. In my case, it seems that the iPadOS was not relevant.
  6. I didn't check if the doubled TTF file works correctly in Excalidraw. I apologize for that.

If you prefer to move it to another Discussions or Issues section, feel free to let me know. Personally, I am not troubled at all, as I can easily recover the TTF file by copying it.

That's all. Sorry to bother you.

vrtmrz commented 7 months ago

Thank you all and do not hesitate to let me contribute for you all! From your information and several investigations, we have now brought to light why.

Obsidian seems to use a specific function internally to write the file on the mobile platform. That function is almost similar to the desktop function but has a minor difference. Because of the difference, the file had its contents repeated in proportion to the number of chunks.

It has been fixed at v0.21.2. Would you mind if I ask you to try this?