Skip to content

Conversation

@PhilLab
Copy link
Contributor

@PhilLab PhilLab commented Jan 11, 2026

  • Tests written, or not not needed

The method actually returned the number of rows, but each row contains
multiple files (currently: 2 or 5, depending on the display rotation).

In the unit test, the expected file count was changed from the original
and correct value 4 to 2 in the commit 66d8756, but the correct change
is in the implementation. Hence, reinstating the old expected value and
the test does pass.

Signed-off-by: Philipp Hasper <vcs@hasper.info>
The crash came from a collision of the improperly coded hash function
GalleryRow#calculateHashCode(). Simply summing the row's file hashes can
easily cause a collision as the same sum can also be achieved by two other
file hashes.
Take two rows with two files each. All having the same parentId=0.
Row 1: 263512 and 148830
Row 2: 279897 and 132445
Summing the hashes given by calculateHashCode() will return in the same
value for Row1 and Row2.
PR #15918 fixed this by migrating away from this faulty hash function.

This commit tests the bugfix first with a known collision and then some
random fileIds for some additional explorative testing.

This commit also removes the problematic calculateHashCode(),
as it is now unused.

Signed-off-by: Philipp Hasper <vcs@hasper.info>
This was originally meant to find the cause of crashes caused by
non-unique IDs in the ViewHolder (#15918 and #16194). But the UI test
still succeeded because it didn't carefully craft the fileIds to cause
the issue. Once the actual reason, a collision of an improper hash
function, was found, a unit test for that scenario was added
instead - see prior commit.

Committing this UI test anyways, as it might be able to catch other,
future regressions.

Signed-off-by: Philipp Hasper <vcs@hasper.info>
@PhilLab PhilLab changed the title Ph/gallery multi select test and fix Gallery multi select test and fix Jan 11, 2026
@PhilLab PhilLab mentioned this pull request Jan 11, 2026
4 tasks
@github-actions
Copy link

Codacy

SpotBugs

CategoryBaseNew
Bad practice4343
Correctness7474
Dodgy code257257
Experimental11
Internationalization77
Malicious code vulnerability33
Multithreaded correctness3434
Performance4444
Security1818
Total481481

@github-actions
Copy link

APK file: https://www.kaminsky.me/nc-dev/android-artifacts/16267.apk

qrcode

To test this change/fix you can simply download above APK file and install and test it in parallel to your existing Nextcloud app.

@github-actions
Copy link

blue-Light-Screenshot test failed, but no output was generated. Maybe a preliminary stage failed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants