[Bug]: Editing coordinates crashes or adds a second {{Location}} because the template is found by plain text match
Maintainers usually reply within 1 day
Nobody has claimed this yet.
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 74/100
Research direction
Start with CoordinateEditHelper.getFormattedWikiText() and the unit tests mentioned in the issue, then reproduce both cases: a description containing “Location” without a template and a lowercase {{location template. Update the template detection to match those cases while excluding {{Object location. Done when both cases pass without a crash or duplicate location template.
Written by the indexing model from the issue text.
Description
CoordinateEditHelper.getFormattedWikiText() decides whether a file already has a {{Location}} template with wikiText.contains("Location"), and then looks for it with indexOf("{{Location"). This goes wrong in two cases:
- The word "Location" appears elsewhere, e.g.
|description={{en|1=Location: the old harbour}}, but there is no {{Location}} template. ThenindexOf("{{Location")is -1 and the coordinate edit crashes withStringIndexOutOfBoundsException: begin -1. - The template is written with a lowercase first letter,
{{location|1.0|2.0}}, which MediaWiki accepts. It isn't recognised, so a second{{Location|...}}is added and the file ends up with two location templates.
I reproduced both by calling getFormattedWikiText() with these texts in a unit test.
Fix idea: find the template with a regex that matches {{Location and {{location (but not {{Object location) and use its position, instead of the plain text check. I'd like to work on this, could you assign me?
- Dominant language
- Kotlin
- Stars
- 1.2k
- Forks
- 1.4k
- Avg merge
- 1d 4h
- Merged PRs (30d)
- 156
Getting set up
- No Dockerfile or Docker Compose file
- Has a pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from commons-app/apps-android-commons
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
commons-app/apps-android-commons#7486 ·
Maintainers usually reply within 1 day
-
[Bug]: Media detail page crashes on file pages with unclosed [[Category: markupPossibly taken @dkrrish9 claimed this 3 days ago. Open
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
commons-app/apps-android-commons#7423 · 7 comments · 1 assignee ·
Maintainers usually reply within 1 day
-
[Bug]: WikiSite treats the /w/ script path as a language variant, producing a bogus "w" language codePossibly taken @shryssssss-maker claimed this 4 days ago. Opendebated
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
commons-app/apps-android-commons#7422 · 4 comments · 1 assignee ·
Maintainers usually reply within 1 day
-
test: unit tests for WikiSite (sub-issue of #6630)Possibly taken @Seyamalam claimed this 5 days ago. Open
Difficulty 2/5 1-3 hours Newbie friendliness 70/100
commons-app/apps-android-commons#7419 · 1 assignee ·
Maintainers usually reply within 1 day
-
Detekt: document why the Dagger provider modules exceed TooManyFunctionsMay be free again @harshkumar3117-svg claimed this 14 days ago, and no pull request is open. Open
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
commons-app/apps-android-commons#7113 · 3 comments ·
Maintainers usually reply within 1 day
All issues in commons-app/apps-android-commons
Similar issues
-
Location search keeps showing stale "Open-Meteo can't find ..." message after clearing search queryOpenBug Needs review
Difficulty 2/5 1-3 hours Newbie friendliness 70/100
breezy-weather/breezy-weather#3082 ·
Maintainers usually reply within 2 days
-
area: ci area: local-media area: startup area: ui platform: bilibili platform: netease platform: youtube status: needs-triage
Difficulty 2/5 1-3 hours Newbie friendliness 70/100
cwuom/NeriPlayer#794 ·
Maintainers usually reply within 1 day
-
area:android area:ui bug priority:P2
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
meraxes89/streamify-apk#449 ·
Maintainers usually reply within 1 day
-
easy first-contributor first-contributors good first issue help wanted kotlin up-for-grabs
Difficulty 1/5 Under an hour Newbie friendliness 95/100
fork-commit-merge/fork-commit-merge#8752 ·
Maintainers usually reply within 1 day
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 67/100
MetrolistGroup/Metrolist#5559 · 2 comments · 1 reaction ·
Maintainers usually reply within 1 day