apps-android-commons: [Bug]: "copy the wikitext to the clipboard" produces different results depending on timing

Summary

Pressing the button copy the wikitext to the clipboard produces a different result depending if the upload is still in progress (wrong result), or whether the upload has finished (correct result).

Steps to reproduce

  1. have a slow network connection
  2. add new picture, fill metadata and submit
  3. while the picture is still uploading (i.e. a progress bar is being shown), click on the copy the wikitext to the clipboard button and paste the result somewhere
  4. wait until the upload finishes
  5. click on the copy the wikitext to the clipboard button again and paste the result somewhere

Expected behaviour

the first and second value copied are the same.

Actual behaviour

The first and second results differ. For example, for this file: https://commons.wikimedia.org/wiki/File:Knafelčeva_markacija_na_odrezanoj_grani,_Prvić.jpg the first copy/paste produces:

[[Knafelčeva markacija na odrezanoj grani, Prvić.jpg|thumb|]]

(which is wrong) while the second copy/paste produces (correct!):

[[File:Knafelčeva markacija na odrezanoj grani, Prvić.jpg|thumb|]]

i.e. the first one misses File: (which then makes problems when one pastes it to the app that expects standard commons format, like e.g. EveryDoor). Especially annoying when the mobile internet is slow, as one is forced to either wait a long time, or manually fix every image name.

Device name

Huawei P30Pro

Android version

Android 10 (EMUI 12)

Commons app version

4.1.0 (latest f-droid)

Device logs

No response

Screen-shots

https://github.com/commons-app/apps-android-commons/assets/156656/71de16af-e770-4aeb-961f-eadd9d19228d

Would you like to work on the issue?

None

About this issue

  • Original URL
  • State: open
  • Created 9 months ago
  • Comments: 21 (12 by maintainers)

Most upvoted comments

my exam r over now, i m all good to go now, i will finish this as soon as i can. thank u!

actually my exams are ongoing ryt now, so i am giveing as much as free time i have on this. so my response might be delay hope you understand.

i did find this code that casing the issue, i m workng on it. thanks you

file -> fr.free.nrw.commons.media.MediaDetailFragment

Screenshot from 2023-10-01 14-39-26

@axelthepony27 well, I don’t really know (I don’t even have local Android SDK installed - I just use GitHub to build it).

But:

  • the “failed to find Platform SDK with path” (which is the real error) seems to me unrelated to the originally reported error (“missing fr.free.nrw.commons.BuildConfig”, which seems to be a red herring)
  • it seems related to your build toolkit, not to Commons app itself. Have you been successfully building any other Android projects on that setup?
  • my first guess would be that the “platforms;android-33” part of the error might indicate you need to download that correct platform? e.g. via menu > Tools > SDK Manager ? As shown in screenshot here
  • if that doesn’t help, I’d try searching the web for the web for similar errors

hello @nicolas-raoul, i am new to the project and exploring the project. Since it is a good-first-issue, can i give it a try?

@mnalis Thanks! Indeed, the problem was solved by installing the correct SDK. I’ll get to work on the issue now, it does appear to concern to the fragment of code that @Kshitiz-Mhto mentioned.

@axelthepony27 And what happens when you try to compile? Do you get some error, or does it just work?

For me, GitHub workflow seems to compile latest main just fine, e.g. https://github.com/mnalis/apps-android-commons/actions/runs/7346949892/job/20002559077

@axelthepony27 It is yours, please let us know about your progress every week or so, thanks! 🙂

Any luck @Kshitiz-Mhto ?

@Kshitiz-Mhto Sure no worries, please focus on your exams, letting us know every 2 weeks is fine. 😃

@Kshitiz-Mhto It is yours, thanks! Please let us know about your progress every few days. 🙂