-
-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
Fixed crash during folder creation (autosync) #5465
Conversation
Codecov Report
@@ Coverage Diff @@
## master #5465 +/- ##
============================================
+ Coverage 21.78% 22.09% +0.31%
Complexity 3 3
============================================
Files 398 398
Lines 33326 33362 +36
Branches 4674 4680 +6
============================================
+ Hits 7259 7373 +114
+ Misses 24888 24802 -86
- Partials 1179 1187 +8
|
Screenshot test failed, but no output was generated. Maybe a preliminary stage failed. |
@@ -0,0 +1,71 @@ | |||
package com.owncloud.android.ui.activity; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Shagequi can you add the license header please :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure, will be done
@@ -302,7 +299,8 @@ public boolean onOptionsItemSelected(MenuItem item) { | |||
boolean retval = true; | |||
switch (item.getItemId()) { | |||
case R.id.action_create_dir: { | |||
CreateFolderDialogFragment dialog = CreateFolderDialogFragment.newInstance(getCurrentFolder()); | |||
OCFile currentFolder = getCurrentFolder(); | |||
CreateFolderDialogFragment dialog = CreateFolderDialogFragment.newInstance(currentFolder); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
no need to split this into two statements, could be reverted (or did I miss a detail here?)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess this was just for debugging, but true, this can be reverted.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yup it was for debugging.
I'm glad it's this name, I sometimes have an excess of imagination in my development (for naming variables or logs 😅)...
I'll fix it ASAP, am working on another project
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wo worries, no hurries :)
@Shagequi Just two minor issues 👍 |
if (currentFile.isFolder()) { | ||
finalFolder = currentFile; | ||
} else if(currentFile.getRemotePath() != null) { | ||
String parentPath = currentFile |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would use new File(currentFile.getRemotePath()).getParent() for this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, I forgot this point too,
will be fixed asap too
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"asap" -> do not hurry too much :-)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This method doesn't work, we need to use the FileStorageManager in all cases, I stay with this solution for now
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
String parentPath = new File(currentFile.getRemotePath()).getParent();
String parentPath1 = currentFile
.getRemotePath()
.substring(0, currentFile.getRemotePath()
.lastIndexOf(currentFile.getFileName()));
Should be exactly the same, and is not error prone :-)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
But, why create a File
object, if we're expecting an OCFile
object ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is just for handling the path part.
I think, using File, is more error prone than trying to to it by our selves.
src/androidTest/java/com/owncloud/android/ui/activity/FolderPickerActivityTest.java
Outdated
Show resolved
Hide resolved
src/androidTest/java/com/owncloud/android/ui/activity/FolderPickerActivityTest.java
Outdated
Show resolved
Hide resolved
src/main/java/com/owncloud/android/ui/activity/FolderPickerActivity.java
Outdated
Show resolved
Hide resolved
Screenshot test failed, but no output was generated. Maybe a preliminary stage failed. |
@tobiasKaminsky Now it's done, would you please merge this important fix ? |
Signed-off-by: tobiasKaminsky <tobias@kaminsky.me>
49842a9
to
a93313c
Compare
I rebased, added two tests and if everything is green, we can merge. |
APK file: https://www.kaminsky.me/nc-dev/android-artifacts/12714.apk |
Codacy360Lint
SpotBugs (new)
SpotBugs (master)
|
All the tests are green :D |
3f62afa Merge remote-tracking branch 'origin/master' into dev 5d428fe Merge pull request #4788 from nextcloud/instantupload_all 49f3a67 ConflictsResolveActivity: code style and readability improvements 6540e3e Upload list conflicts: replace trash icon with menu and add resolve action a4ff1f1 Customize upload sync conflict notification strings e77ffa0 Fix synced folder layout form control widgets alignment 91ef307 Fix database migration of field forceOverwrite to NameCollisionPolicy 52d089b FileUploader: fix codacy issues and SpotBugs ec27f84 FileUploader: code cleanup 7713a28 FileUploader: require explicit NameCollisionPolicy and change default used value 6783e8a Make file uploads ask the user what to do when the file already exists on remote 213002f Make newly created synced folders auto upload existing files by default 1b7bd72 ADD: [instantupload] setting to also upload existing files c243453 Merge pull request #5465 from nextcloud/fix/create-folder-crash-autosync d178cde daily dev 20200218
Hi,
I fixed bug relative to folder picker, because mFile was always returning null.
Fixes #4792