imessage-exporter icon indicating copy to clipboard operation
imessage-exporter copied to clipboard

[BUG] no image attachements in html format

Open cedricloneux opened this issue 2 years ago • 3 comments

When generating an archive with HTML files the images don't appear into the conversation. But an attachements directory is correctly created in file structure<;

Tried on intel mac. Golden master binary and cloned repo at current state.

cedricloneux avatar Jan 16 '23 15:01 cedricloneux

Do the filepaths in the HTML work if you go to them directly?

ReagentX avatar Jan 16 '23 18:01 ReagentX

When opening a generated html file on safari, brave or even opera. (so we can safely say all browsers) a path such as: file:///Users/cedricloneux/Downloads/messages/<PHONE_NUMBER>.html

the images are not shown but <img> tags are in the HTML file. A bit of debugging and I got images working using absolute path instead of relative path.

cedricloneux avatar Jan 17 '23 18:01 cedricloneux

How did you change the paths to get this working?

ReagentX avatar Jan 17 '23 18:01 ReagentX

As I said, I manually changed the image path from relative to absolute. Meaning complete path from root directly /

cedricloneux avatar Jan 17 '23 22:01 cedricloneux

~~Ok, so the broken paths had a ~ prefixing them? If so, I need to add some code to expand that. If it wasn't a ~, what were they relative to?~~

I understand the issue, right now imessage-exporter drops attachments in the specified output directory, which when set manually is relative to the working directory the program was launched in. To improve compatibility this path should get expanded.

https://github.com/ReagentX/imessage-exporter/blob/c5006a30e7d7b71e5873bef551724a3ab3ac7dac/imessage-exporter/src/exporters/html.rs#L390-L392

ReagentX avatar Jan 17 '23 22:01 ReagentX

Shouldn't this actually use the relative path, so that the archive can be stored elsewhere and viewed? I took a full db dump from my mac and moved it to my NAS, but none of my conversations work because each image is <source src="/Users/user.name/imessage_export/attachments/fccb2309-9b2e-4bd9-9ef6-cc5d19baceab.mov"...>

Wouldn't it make sense to just look one level up so as long as /attachments is in the directory of the html files, images can be viewed?

mbaran5 avatar Jan 17 '23 23:01 mbaran5

That sounds reasonable, I will implement that going forward.

ReagentX avatar Jan 17 '23 23:01 ReagentX

I can confirm this works as well. Adjusting the path to just attachments/... allows the file to be read with photos and videos from another PC via the network. I modified a small conversation of mine.

mbaran5 avatar Jan 17 '23 23:01 mbaran5

Thank you for the suggestion!

ReagentX avatar Jan 18 '23 00:01 ReagentX