Skip to content

fix: upsert single file#16146

Merged
alperozturk96 merged 3 commits into
masterfrom
fix/upsert-single-file
Dec 19, 2025
Merged

fix: upsert single file#16146
alperozturk96 merged 3 commits into
masterfrom
fix/upsert-single-file

Conversation

@alperozturk96
Copy link
Copy Markdown
Collaborator

@alperozturk96 alperozturk96 commented Dec 16, 2025

  • Tests written, or not not needed

Issue

Helps: #16139. Please read the issue first.

Changes

  • Replaces CONFLICT_REPLACE with CONFLICT_IGNORE to prevent overwriting during insert.

  • Tries insert first, then updates if the file already exists, instead of querying first.

    • This avoids race conditions: if two threads query at the same time, both might try the same action, but with insert-first, the database ensures atomicity, so the second thread sees the correct state.
  • Auto-closes cursor using try-with-resources.

  • Adds proper update logic if insert fails.

  • Adds tests.

How to test?

  • Upload a new file

@alperozturk96
Copy link
Copy Markdown
Collaborator Author

/backport to stable-3.35

@github-actions
Copy link
Copy Markdown

Codacy

SpotBugs

CategoryBaseNew
Bad practice4343
Correctness7474
Dodgy code258258
Experimental11
Internationalization77
Malicious code vulnerability33
Multithreaded correctness3434
Performance4545
Security1818
Total483483

@github-actions
Copy link
Copy Markdown

APK file: https://www.kaminsky.me/nc-dev/android-artifacts/16146.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
Copy Markdown

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

@alperozturk96 alperozturk96 merged commit b93b270 into master Dec 19, 2025
19 of 23 checks passed
@alperozturk96 alperozturk96 deleted the fix/upsert-single-file branch December 19, 2025 07:14
@alperozturk96 alperozturk96 added this to the Nextcloud App 3.35.0 milestone Dec 19, 2025
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.

1 participant