Skip to content

Commit 54292a5

Browse files
committed
Uplift of #29093 (squashed) to beta
1 parent aa57feb commit 54292a5

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

ios/brave-ios/Sources/Playlist/PlaylistDownloadManager.swift

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -413,7 +413,7 @@ private class PlaylistHLSDownloadManager: NSObject, AVAssetDownloadDelegate {
413413
func urlSession(
414414
_ session: URLSession,
415415
assetDownloadTask: AVAssetDownloadTask,
416-
didFinishDownloadingTo location: URL
416+
willDownloadTo location: URL
417417
) {
418418
pendingDownloadTasks[assetDownloadTask] = location
419419
}
@@ -531,7 +531,8 @@ private class PlaylistHLSDownloadManager: NSObject, AVAssetDownloadDelegate {
531531
// so we must synchonously move the file to a temporary directory first before processing it
532532
// on a different thread since the Task will execute after this method returns
533533
let assetUrl = FileManager.default.temporaryDirectory
534-
.appending(component: "\(asset.id)-\(temporaryUrl.lastPathComponent)")
534+
.appending(component: asset.id).appendingPathExtension(temporaryUrl.pathExtension)
535+
535536
try? FileManager.default.moveItem(at: temporaryUrl, to: assetUrl)
536537

537538
@Sendable func cleanupAndFailDownload(location: URL?, error: Error) async {
@@ -920,7 +921,7 @@ private class PlaylistFileDownloadManager: NSObject, URLSessionDownloadDelegate
920921
// so we must synchonously move the file to a temporary directory first before processing it
921922
// on a different thread since the Task will execute after this method returns
922923
let temporaryLocation = FileManager.default.temporaryDirectory
923-
.appending(component: location.lastPathComponent)
924+
.appending(component: asset.id).appendingPathExtension(location.pathExtension)
924925
try? FileManager.default.moveItem(at: location, to: temporaryLocation)
925926
Task {
926927
// Couldn't determine file type so we assume mp4 which is the most widely used container.

0 commit comments

Comments
 (0)