carderne / signal-export

Export your Signal chats to markdown files with attachments
Other
436 stars 46 forks source link

Missing Attachments #83

Closed Grantguin closed 1 year ago

Grantguin commented 1 year ago

Hello,

I backed up and restored Signal a few months ago, but apparently did so without the attachments. So my attachments.noindex directories are missing some files that this script is trying to copy (maybe it sees them as existing from some kinda manifest even if they don't exist on the computer?).

I get the following error:

│ C:\Users\User\AppData\Local\Programs\Python\Python310\lib\shutil.py:254 in copyfile │ │ │ │ 251 │ if not follow_symlinks and _islink(src): │ │ 252 │ │ os.symlink(os.readlink(src), dst) │ │ 253 │ else: │ │ > 254 │ │ with open(src, 'rb') as fsrc: │ │ 255 │ │ │ try: │ │ 256 │ │ │ │ with open(dst, 'wb') as fdst: │ │ 257 │ │ │ │ │ # macOS │ │ │ │ ┌─────────────────────────────────────────── locals ───────────────────────────────────────────┐ │ │ │ dst = WindowsPath('C:/Users/User/signal-chats/Computer/media/2021-05-19T0… │ │ │ │ file_size = 0 │ │ │ │ fn = WindowsPath('C:/Users/User/signal-chats/Computer/media/2021-05-19T0… │ │ │ │ follow_symlinks = True │ │ │ │ i = 1 │ │ │ │ src = WindowsPath('C:/Users/User/AppData/Roaming/Signal/attachments.noindex/6d… │ │ │ └──────────────────────────────────────────────────────────────────────────────────────────────┘ │ └──────────────────────────────────────────────────────────────────────────────────────────────────┘ FileNotFoundError: [Errno 2] No such file or directory: 'C:\\Users\\User\\AppData\\Roaming\\Signal\\attachments.noindex\\6d\\6d79a3e04e1cd3bd9c3c640171f2c7e048ba3758926ba63cacee8834380720c0'

The above error is from using sigexport --chats=Notes which was a group that was actually created in Signal this year (2022), so I'm not sure why it's trying to pull images from a date in May 2021.

I've tried adding a placeholder image with the filename in the respective attachments.noindex directory, but there are countless attachments that are missing from last year and I was wondering if there was some way around this, maybe like a quick hack to check for the existence of a file and not try to copy it if it doesn't?

Thank you in advance!! :-)

njgte commented 1 year ago

I am experiencing the same issue. I am on Lubuntu and have installed Signal as a snap. I was able to run the export by cloning the repo and catching the exception when copying attachments. There were 2 or 3 attachments that were not found, the rest went through without issues. However all of the downloaded attachments are somehow broken. I don't know if it connected, I'll open a new issue for that.

carderne commented 1 year ago

Hi @Grantguin @noahjgente this should now be fixed by https://github.com/carderne/signal-export/commit/0e8761e5404c5f0c83adda04f3fff6d9fe5e5915. You will get a lot of loud output about the missing attachments.