Skip to content

Posting a memo with an image while online uploads the image twice, leaving an unlinked copy #399

Closed

Description

@pdlourenco

Versions: Memos 0.31.0 · Mortis 0.31.0 · Moe Memos for Android on Android

What happens: posting a memo with an attached image from Moe while online stores the image twice on the server. One copy is attached to the memo. The other is left in Memos' "Unlinked uploads" list ("these uploads were never attached to a memo"). It costs double the storage per image and leaves an orphan that has to be cleaned up by hand.

Isolated with four tests, each adding one thing, counting stored files and attachment records each time:

Test Files stored Attachment records Result
Web UI, image linked in content +1 +1 clean
Web UI, image attached +1 +1 clean
Moe, online, image attached +2 +1 duplicate
Moe, written offline, synced on reconnect +1 +1 clean

So it's not the server (web UI is clean either way), and it's not the attachment itself (the offline path is clean). Only online posting from Moe duplicates.

The two stored copies: same original filename and size, but different UUIDs, with upload timestamps exactly 2 seconds apart. That gap was the same on two separate occasions days apart. Deleting the memo removed the later copy each time, so the second upload is the one attached to the memo, and the first is the orphan.

A guess, offered as a guess: the image is uploaded once when it's picked, and again when the memo is sent. Offline, the first upload can't happen, which would explain why that path is clean. The fixed 2-second gap fits a deterministic double upload better than a retry, which I'd expect to vary.

I can't test Moe without Mortis, because the current release of Moe doesn't accept a 0.31.0 server directly (even if the code already does, I believe), so I can't say which of the two is responsible. Filed here because the duplicate depends on the client being online.

PS: Thanks for the hard work, having this app with the widget is great!

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions