Skip to content

Commit

Permalink
fix: delete local file first since we build url with data from DB (op…
Browse files Browse the repository at this point in the history
…enedx#453)

Co-authored-by: Anton Yarmolenko <[email protected]>
  • Loading branch information
rnr and rnr authored Jun 11, 2024
1 parent 0933ddd commit c39b087
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions Core/Core/Network/DownloadManager.swift
Original file line number Diff line number Diff line change
Expand Up @@ -274,11 +274,11 @@ public class DownloadManager: DownloadManagerProtocol {
public func deleteFile(blocks: [CourseBlock]) async {
for block in blocks {
do {
try persistence.deleteDownloadDataTask(id: block.id)
currentDownloadEventPublisher.send(.deletedFile(block.id))
if let fileURL = await fileUrl(for: block.id) {
try FileManager.default.removeItem(at: fileURL)
}
try persistence.deleteDownloadDataTask(id: block.id)
currentDownloadEventPublisher.send(.deletedFile(block.id))
} catch {
debugLog("Error deleting file: \(error.localizedDescription)")
}
Expand Down

0 comments on commit c39b087

Please sign in to comment.