iOS import seems broken for .mochi/.apkg files and for CSV/Markdown attachments

iOS import seems broken for .mochi/.apkg files and for CSV/Markdown attachments

Hi, I think I may have found an iOS-specific import bug, but I am not completely sure where in the app it is happening. I reached this through trial and error while trying to import a study deck into the iOS app.

The original deck imports correctly in the Linux desktop version of Mochi. However, when I try to import the same material on iOS as a .mochi file, the import fails with this error:

this._realReader.readAsArrayBuffer is not a function. (In 'this._realReader.readAsArrayBuffer(file)', 'this._realReader.readAsArrayBuffer' is undefined)

At first I thought the problem might be my generated .mochi file, so I tried to narrow it down. I exported the same workspace from the Linux desktop app as a .mochi file and tried importing that exported file on iOS. It failed with the same error. That made me think the issue was probably not the structure of my generated file.

Then I created a minimal text-only .mochi file with no images or attachments, just a very small data.edn. That also failed on iOS with the same readAsArrayBuffer error. So the problem does not seem to be caused by images, attachment size, or the deck contents.

After that, I tried using Anki .apkg instead. I converted the deck into an Anki package. The converted .apkg imports correctly in the Linux desktop version of Mochi, but on iOS it fails with:

An unexpected error occurred. The importer encountered an unexpected error when trying to import this file. It could mean that there is an issue with the file, or there is a bug in the importer. Promise error.

I also tried a very small text-only .apkg file with no media. That failed on iOS too. So it does not look like the issue is specific to media inside .apkg packages either.

Next I tested Markdown and CSV. Text-only CSV import works on iOS. Text-only Markdown import also works on iOS.

However, when I tried importing CSV or Markdown with an image attachment, the import got stuck at:

Cloning deck; Saving attachments...

The progress bar stayed blank and never advanced. This happened with both CSV and Markdown.

To check whether the image was too large or somehow malformed, I tried again with a tiny 1x1 PNG image. The same thing happened: the iOS app got stuck at Cloning deck; Saving attachments.... So this does not seem to be caused by the image size or by the original image file.

To sum things up:

  • .mochi import fails on iOS even with a minimal text-only package.
  • .apkg import fails on iOS even with a minimal text-only package.
  • CSV and Markdown import work on iOS only when they are text-only.
  • CSV and Markdown imports hang on iOS as soon as an attachment needs to be saved.
  • The same real decks import correctly in the Linux desktop app.

So it looks like there may be an iOS-specific issue in the file-reading/import path, and another issue or related issue when saving imported attachments.

The test were made on the 1.21.16 version with an iPhone 15 Pro Max and the Arch Linux app. Everything was tested both logged in and logged out without difference.

0 Replies