-
Notifications
You must be signed in to change notification settings - Fork 854
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
Fix only 1 file uploading when selecting multiple #2537
Fix only 1 file uploading when selecting multiple #2537
Conversation
|
||
for urlIn in urls { | ||
let ocId = NSUUID().uuidString |
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.
We used the same id for all files, which caused them to get overwritten in Realm. Now each file has a different ID.
if let _ = NCManageDatabase.shared.getMetadataConflict(account: appDelegate.account, serverUrl: serverUrl, fileNameView: fileName) { | ||
metadatasInConflict.append(metadataForUpload) | ||
} else { | ||
metadatas.append(metadataForUpload) | ||
} | ||
} | ||
|
||
if let conflict = UIStoryboard(name: "NCCreateFormUploadConflict", bundle: nil).instantiateInitialViewController() as? NCCreateFormUploadConflict { | ||
NCNetworkingProcessUpload.shared.createProcessUploads(metadatas: metadatas, completion: { _ in }) | ||
|
||
conflict.delegate = appDelegate | ||
conflict.serverUrl = serverUrl | ||
conflict.metadatasUploadInConflict = [metadataForUpload] | ||
if !metadatasInConflict.isEmpty { | ||
if let conflict = UIStoryboard(name: "NCCreateFormUploadConflict", bundle: nil).instantiateInitialViewController() as? NCCreateFormUploadConflict { | ||
|
||
appDelegate.window?.rootViewController?.present(conflict, animated: true, completion: nil) | ||
} | ||
conflict.delegate = appDelegate | ||
conflict.serverUrl = serverUrl | ||
conflict.metadatasUploadInConflict = metadatasInConflict | ||
|
||
} else { | ||
NCNetworkingProcessUpload.shared.createProcessUploads(metadatas: [metadataForUpload], completion: { _ in }) | ||
appDelegate.window?.rootViewController?.present(conflict, animated: true, completion: nil) | ||
} | ||
} | ||
} |
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.
Files in conflict will go through NCCreateFormUploadConflict
, while the rest would continue uploading normally.
@marinofaggiana It would be great if you can test this manually, in case i missed anything. I will also try to make some unit/integration tests for this. |
Codecov ReportPatch and project coverage have no change.
Additional details and impacted files@@ Coverage Diff @@
## develop #2537 +/- ##
=======================================
Coverage 9.19% 9.20%
=======================================
Files 185 185
Lines 26124 26129 +5
Branches 9775 9775
=======================================
+ Hits 2401 2404 +3
- Misses 23510 23513 +3
+ Partials 213 212 -1
☔ View full report in Codecov by Sentry. |
Please rebase before PR (the database version is different and this removed the current DB in the emulator, so I must reinsert the accounts etc) |
…upload-file-selecting-multiple-files-only-1-file-uploads
@marinofaggiana done |
|
||
let fileName = urlIn.lastPathComponent | ||
let toPath = CCUtility.getDirectoryProviderStorageOcId(ocId, fileNameView: fileName)! | ||
let urlOut = URL(fileURLWithPath: toPath) | ||
let serverUrl = appDelegate.activeServerUrl | ||
|
||
guard let url = self.copySecurityScopedResource(url: urlIn, urlOut: urlOut) else { continue } |
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.
please fix lint here, url is not used.
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.
works.
Signed-off-by: Milen Pivchev <milen.pivchev@gmail.com>
This closes #2532