Skip to content

App corrupts Commons description #4957

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
nicolas-raoul opened this issue May 16, 2022 · 4 comments
Closed

App corrupts Commons description #4957

nicolas-raoul opened this issue May 16, 2022 · 4 comments

Comments

@nicolas-raoul
Copy link
Member

nicolas-raoul commented May 16, 2022

App erroneously modified |description= to |descriptio

https://commons.wikimedia.org/w/index.php?title=File%3A%E4%B9%9D%E5%8D%81%E4%B9%9D%E9%87%8C%E6%B5%9C_7.jpg&type=revision&diff=655568871&oldid=655568708

Another example: https://commons.wikimedia.org/w/index.php?title=File:Fishtbnk_truck_near_Kujukuri_beach.jpg&diff=prev&oldid=656180711

I believe that happened when editing the caption.

Current master

@misaochan misaochan added this to the v4.0.0 beta milestone May 19, 2022
@madhurgupta10
Copy link
Collaborator

@nicolas-raoul Could you share the exact steps to reproduce this issue?

@madhurgupta10
Copy link
Collaborator

Also pinging @Ayan-10 as this seems related to #4672

@Ayan-10
Copy link
Contributor

Ayan-10 commented May 19, 2022

@madhurgupta10 @nicolas-raoul I have investigated the issue. This issue occurs when the file doesn't have any description in any language and user only add a caption without a description. Like this file: https://commons.wikimedia.org/w/index.php?title=File:Fishtbnk_truck_near_Kujukuri_beach.jpg&diff=prev&oldid=656180711 doesn't have any description or caption, now if user add a caption in a language without a description in the editor screen. This issue will occur.

The lines, causing the issue are

Line 157: buffer.deleteCharAt(buffer.length - 1)
Line 158: buffer.deleteCharAt(buffer.length - 1)

in the DescriptionEditActivity. But these lines are important if the file has any description. I think the issue can be resolved by checking if any description is present in the list.

Thanks

@madhurgupta10
Copy link
Collaborator

@madhurgupta10 @nicolas-raoul I have investigated the issue. This issue occurs when the file doesn't have any description in any language and user only add a caption without a description. Like this file: https://commons.wikimedia.org/w/index.php?title=File:Fishtbnk_truck_near_Kujukuri_beach.jpg&diff=prev&oldid=656180711 doesn't have any description or caption, now if user add a caption in a language without a description in the editor screen. This issue will occur.

The lines, causing the issue are

Line 157: buffer.deleteCharAt(buffer.length - 1)
Line 158: buffer.deleteCharAt(buffer.length - 1)

in the DescriptionEditActivity. But these lines are important if the file has any description. I think the issue can be resolved by checking if any description is present in the list.

Thanks

Thanks for the detailed investigation, I believe these two lines are added to remove the extra , from the buffer string, in that case, I think replacing them with a regex pattern is a much better solution

madhurgupta10 added a commit to madhurgupta10/apps-android-commons that referenced this issue May 20, 2022
nicolas-raoul pushed a commit that referenced this issue May 20, 2022
misaochan added a commit that referenced this issue Aug 8, 2022
* Fix string for custom selector

* Fix bug #4950 back arrow still present on top-level activity (#4952)

* Fix bug #4949 by correctly setting previous db version number (#4956)

* Fix bug #4949 by correctly setting previous db version number

* Fix failing tests

* Fix bug #4959 by correctly setting previous db version number and updating the current db version (#4960)

* Fix bug #4957 (#4961)

* Update library to new version that handles older Java VMs

Fixes #4972 I believe.

* Versioning for v4.0.0

* Changelog for v4.0.0

* Fix bug #4984 Added queries for package name for Android API 30+ (#4987)

* Update mapbox sdk version (#4989)

* Versioning for v4.0.1

* Changelog for v4.0.1

* Remove network type information from NetworkUtils (#4996)

* Remove network type information from NetworkUtils

* Ignore dependent tests

* Fix #4992 invert the equals condition to be null safe (#4995)

* Fix java.lang.NullPointerException for username in ContributionBoundaryCallback (#5003)

* Fix failing tests for PR #5003 (#5004)

* Fix java.lang.NullPointerException for username in ContributionBoundaryCallback

* Fix failing tests

* Update Room DB Version (#5011)

* Fix #5001 (#5010)

* Fix DB update issue (#5016)

* [WIP] Fix both timezone problem and saved date problem (#5019)

* Fix both timezone problem and saved date problem

* Fixaccidental test code and add comments

* Add issue link to the comments

* Fix format issue and null checks

* Versioning for v4.0.2

* Changelog for v4.0.2

* Add "Report Violation" menu option (#5025)

* Add "Report Violation" menu option

* Update email template

* Update email address

* Fixed typo

Co-authored-by: Josephine Lim <josephinelim86@gmail.com>

* Versioning for v4.0.3

* Changelog for v4.0.3

Co-authored-by: Josephine Lim <josephinelim86@gmail.com>
Co-authored-by: Nicolas Raoul <nicolas.raoul@gmail.com>
Co-authored-by: neslihanturan <tur.neslihan@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants