MaxiHuHe04/iTunes-Backup-Explorer

Large exports fail after a time with no error

tetrahedrl opened this issue · 4 comments

Hi, trying to export my SMS attachments (on windows).

I select MediaDomain/Library/SMS/Attachments, it works for a while trying to export, then the progress bar unceremoniously closes and the tasbar icon blinks orange, no error box. A significant amount of it does get exported, but much of it doesn't. All of the folders one step below attachments get created, but some of these are left empty.

I suspect it's having trouble with specific files, because...

  • If I try to export in the same location and skip already exported, it stops immediately with no further progress (hits file it has trouble with immediately)
  • If I deselect the subfolders where it's already tried to create the subfolders beneath, it will continue further and get more of the export complete, but then fails again later.

Is there any kind of logging I can turn on to find the specific files it's failing on? Thanks.

Hey @tetrahedrl!
That sounds interesting. Could you try exporting the folder again after launching the program using the command java -jar itunes-backup-explorer-1.2.jar in a terminal? This should hopefully give us some logs.

It looks like the issue is file names that are okay on iOS, but invalid on Windows.

I tried running from Windows Terminal, where it gave no message when the export failed. So I went ahead and cloned the repo, added a line of code printing the filename in the for loop at exportFiles(List<BackupFile> files, File destination) in FilesTabController.java and let it run. The last file it attempted before stopping was named cm-chat-media-video-1:a15bd878-dc03-5591-864c-cec5096a6b77:609:0:0.MOV, which was also the last attempted when picking just the /39/09 subfolder it was in. Attempting to export the file on its own was where I realized this issue, as Windows didn't let me use the autofilled file name due to the : character.

The video file works perfectly fine if I export it on its own and specify a different filename.
I assume to solve this, we just need to remove special characters in filenames before trying to save them in bulk exports.

From messing around with printing debug info as it steps through (can't get my debugger working to use breakpoints haha), it seems the place things first go wrong with this filename at

String relative = withRelativePath ? Paths.get(this.domain, this.relativePath).toString() : this.getFileName();

in

public void extractToFolder(File destinationFolder, boolean withRelativePath)

in BackupFile.java, when this.relativePath is Library/SMS/Attachments/39/09/71A2C810-207D-4175-82A4-93274D00028F/cm-chat-media-video-1:a15bd878-dc03-5591-864c-cec5096a6b77:609:0:0.MOV and this.getFileName() returns cm-chat-media-video-1:a15bd878-dc03-5591-864c-cec5096a6b77:609:0:0.MOV

Paths throws an InvalidPathException when it sees the invalid character :

Addressed (not sure if for all cases) in #13