ankidroid / Anki-Android

AnkiDroid: Anki flashcards on Android. Your secret trick to achieve superhuman information retention.
GNU General Public License v3.0
8.18k stars 2.17k forks source link

Incorrect Handling of Media Filenames #16462

Open E0697 opened 2 months ago

E0697 commented 2 months ago

Checked for duplicates?

Does it also happen in the desktop version?

What are the steps to reproduce this bug?

  1. Create a long screenshot in Brave for Android (from sharing hub)
  2. The resulting file has a filename template that follows this example: chrome_screenshot_May 22, 2024 4_54_13 PM GMT+03_00
  3. Add above file to a card
  4. Use the media check tool > Image file is deemed unused

Expected behaviour

The file shouldn't show up in the media check as unused. The check result should be empty (no unreferenced cards).

Actual behaviour

The file is detected as unreferenced, and isn't included in exports.

Debug info

AnkiDroid Version = 2.18.0 (464cf290cc77c3f2c562cb03b408b78a13be261b)

Backend Version = 0.1.38-anki24.04.1 (24.04.1 ccd9ca1a8309b80bcb50ddc5d99c7ce63440bce9)

Android Version = 14 (SDK 34)

ProductFlavor = full

Manufacturer = realme

Model = 7 Pro

Hardware = qcom

Webview User Agent = Mozilla/5.0 (Linux; Android 14; 7 Pro Build/UQ1A.240205.004; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/124.0.6367.179 Mobile Safari/537.36

ACRA UUID = e30b1244-b08d-4fdd-ad9a-a898dde99cee

FSRS Enabled = false

Crash Reports Enabled = true

(Optional) Anything else you want to share?

I tried changing the filename to 'chrome' and it worked properly, tried removing spaces and some other characters but it didn't help.

Here's a sample deck (single card) and the media file seperately: Deck+Media.zip

Research

E0697 commented 2 months ago

Might be related: https://github.com/ankidroid/Anki-Android/pull/15890#issue-2185923304

david-allison commented 1 month ago

Reproduced this in Anki Desktop. Image renders, but shown as unavailable

Screenshot 2024-06-05 at 19 22 03

16462.colpkg.zip

Please report this as a bug in Anki Desktop

mikehardy commented 1 month ago

I think that means we can actually close here correct? As it will just come in automatically once we ingest whatever version of desktop gets the fix? (that is, there's no actual action here, and keeping an issue open just for tracking seems like busy-work and list clutter, to my)

david-allison commented 1 month ago

Sure - ideally with a reference to the upstream issue

E0697 commented 1 month ago

It's true that it's reproducible on the desktop apps if you import a note created in AnkiDroid. If you create the note on the desktop app however, it works properly. Importing a note created on a desktop app also works without any issues on AnkiDroid. AnkiDroid stores the filename "example img.png" as "example%20img.png". Replacing the %20 with a space seems to fix the problem. That's also how it shows up in the note created on desktop when I import it.