BugFix - Stop Re-Upload Same File Due To File Extension#15253
BugFix - Stop Re-Upload Same File Due To File Extension#15253alperozturk96 wants to merge 11 commits intomasterfrom
Conversation
|
/backport to stable-3.32 |
app/src/main/java/com/nextcloud/client/jobs/operation/FileOperationHelper.kt
Outdated
Show resolved
Hide resolved
1936b91 to
e2c219b
Compare
| } | ||
|
|
||
| val remoteFile = getRemoteFile(path) | ||
| val remoteFile = fileOperationHelper.getRemoteFile(path, client) |
There was a problem hiding this comment.
OfflineOperationWorker was updated to use the logic in FileUtil to prevent code duplication and unify similar functionality.
| getFileByDecryptedRemotePath(lc) ?: getFileByDecryptedRemotePath(uc) | ||
| } | ||
|
|
||
| if (upload.toFile()?.length() == remoteFile?.fileLength) { |
There was a problem hiding this comment.
I need to compare a local file intended for upload with an existing remote file to determine if they are exactly the same. While file size can be used as a basic check, I’m looking for a more reliable method.
Using eTags is not feasible in this case, as the file to be uploaded (OCUpload) does not have an eTag yet. Similarly, relying on the modification timestamp is unreliable, since it can change due to non-content-related operations such as permission updates or file copying.
At this point, I have a java.io.File object and an OCFile instance, and I need to determine whether they represent the same file content.
Any suggestions for a more robust comparison method beyond file size?
Signed-off-by: alperozturk <alper_ozturk@proton.me>
Signed-off-by: alperozturk <alper_ozturk@proton.me>
Signed-off-by: alperozturk <alper_ozturk@proton.me>
Signed-off-by: alperozturk <alper_ozturk@proton.me>
Signed-off-by: alperozturk <alper_ozturk@proton.me>
Signed-off-by: alperozturk <alper_ozturk@proton.me>
Signed-off-by: alperozturk <alper_ozturk@proton.me>
Signed-off-by: alperozturk <alper_ozturk@proton.me>
Signed-off-by: alperozturk <alper_ozturk@proton.me>
Signed-off-by: alperozturk <alper_ozturk@proton.me>
Signed-off-by: alperozturk <alper_ozturk@proton.me>
6a85f12 to
3b6f42e
Compare
|
test-Unit test failed, but no output was generated. Maybe a preliminary stage failed. |
|
APK file: https://www.kaminsky.me/nc-dev/android-artifacts/15253.apk |
|
Unfortunately, this change makes it worse for my use case 😢. I use to following workflow to upload my pictures (with ending .JPG):
With the previous version two files were created:
For some reason the .JPG files were never deleted and I had to clean them up manually. With the linked version above, I only get the following file:
And the file with actual content is lost :( So please consider reworking the whole "changing of file extension to lowercase feature" as it can cause a lot of trouble. |
|
|
I have "enforce windows compatible mode" disabled. Still the file extensions get renamed from upper case to lower case: JPG -> jpg or MP4 -> mp4 Uploading via the Nextcloud app works fine (still does the renaming), but uploading via the inbuilt File browser is broken. |

Issue
When uploading a file, the app changes the file extension to lowercase (e.g., .JPG becomes .jpg). This leads to duplicate uploads if the same file was previously uploaded with the original (uppercase) extension, since the system may treat
.JPGand.jpgas different files.This behavior has resulted in thousands of unintended duplicates.
How to reproduce?
be.mov
Solution
If one of the remote path variant (File.JPG or File.jpg) exists in remote and file didn't change, skip the upload process.
@mpivchev Please check this for iOS as well. @tobiasKaminsky fyi.
After
pt.mp4
How to test?