Anki-Android icon indicating copy to clipboard operation
Anki-Android copied to clipboard

[BUG]: Externally loaded JavaScript doesn't seem to work anymore in 2.18

Open Azzert opened this issue 1 year ago • 4 comments

Checked for duplicates?

  • [X] This issue is not a duplicate

Does it also happen in the desktop version?

  • [X] This bug does not occur in the latest version of Anki

What are the steps to reproduce this bug?

Using import '<path to file in collection.media>'; in a card's script tag doesn't seem to work anymore, either through a relative path or by using the 'https://appassets.androidplatform.net' prefix.

Expected behaviour

The file is imported correctly as in the desktop version or at least can be imported through the prefix mentioned above.

Actual behaviour

The file fails to be imported. Looking through the debugger, it complains that file:// is not a valid protocol in CORS when using a relative path and it says the file wasn't found when using the appassets URL.

Debug info

AnkiDroid Version = 2.18beta2 (dc5348852b15e0f27521acd3c5457595f4676f54)

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

Android Version = 11 (SDK 30)

ProductFlavor = play

Manufacturer = motorola

Model = moto g(10)

Hardware = qcom

Webview User Agent = Mozilla/5.0 (Linux; Android 11; moto g(10) Build/RRBS31.Q1-3-48-22; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/125.0.6422.26 Mobile Safari/537.36

ACRA UUID = 259a6cb7-7280-4007-8d07-39acff87e836

FSRS Enabled = false

Crash Reports Enabled = true

(Optional) Anything else you want to share?

This used to work in the previous version (2.17). I might be wrong, but I think it may have been inadvertently added in this commit.

Research

  • [X] I am reporting a bug specific to AnkiDroid (Android app)
  • [X] I have checked the manual and the FAQ and could not find a solution to my issue
  • [ ] (Optional) I have confirmed the issue is not resolved in the latest alpha release (instructions)

Azzert avatar May 04 '24 14:05 Azzert

Hello! 👋 Thanks for logging this issue. Please remember we are all volunteers here, so some patience may be required before we can get to the issue. Also remember that the fastest way to get resolution on an issue is to propose a change directly, https://github.com/ankidroid/Anki-Android/wiki/Contributing

welcome[bot] avatar May 04 '24 14:05 welcome[bot]

@BrayanDSO FYI

david-allison avatar May 04 '24 14:05 david-allison

Hello there. Could you please share an apkg file with the related notetype so I can reproduce it here?

BrayanDSO avatar May 04 '24 14:05 BrayanDSO

Of course, here you have a small test one I created: test-deck.zip. I've put the JS file that should be in collection.media next to the .apkg since it wasn't being included when I exported the deck.

Azzert avatar May 04 '24 15:05 Azzert