Skip to content

Commit dbc34ee

Browse files
naveens-fieldwirenaveenshan01
authored andcommitted
The issue is introduced due to refactor to migrate the localURLS to Uploadable.
let fileName = options.storeOptions.filename ?? UUID().uuidString Before let fileName = storeOptions.filename ?? localURL.lastPathComponent
1 parent c7ed131 commit dbc34ee

File tree

4 files changed

+11
-1
lines changed

4 files changed

+11
-1
lines changed

FilestackSDK/Internal/Uploaders/MultipartUpload.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,7 @@ private extension MultipartUpload {
145145
func doUploadFile() {
146146
currentStatus = .inProgress
147147

148-
let fileName = options.storeOptions.filename ?? UUID().uuidString
148+
let fileName = options.storeOptions.filename ?? uploadable.filename ?? UUID().uuidString
149149
let mimeType = options.storeOptions.mimeType ?? uploadable.mimeType ?? "text/plain"
150150

151151
guard let fileSize = uploadable.size, !fileName.isEmpty else {

FilestackSDK/Public/Extensions/Data+Uploadable.swift

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,10 @@
99
import Foundation
1010

1111
extension Data: Uploadable {
12+
public var filename: String? {
13+
return nil
14+
}
15+
1216
public var size: UInt64? {
1317
return UInt64(count)
1418
}

FilestackSDK/Public/Extensions/URL+Uploadable.swift

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,10 @@ import Foundation
1010
import MobileCoreServices
1111

1212
extension URL: Uploadable {
13+
public var filename: String? {
14+
return lastPathComponent
15+
}
16+
1317
public var size: UInt64? {
1418
guard let attributtes = try? FileManager.default.attributesOfItem(atPath: relativePath) else { return nil }
1519

FilestackSDK/Public/Protocols/Uploadable.swift

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@ import Foundation
1010

1111
/// The protocol any uploadables must conform to.
1212
public protocol Uploadable {
13+
/// The fileName of this uploadable, or `nil` if unavailable.
14+
var filename: String? { get }
1315
/// The size of this uploadable in bytes, or `nil` if unavailable.
1416
var size: UInt64? { get }
1517
/// The MIME type of this uploadable, or `nil` if unavailable.

0 commit comments

Comments
 (0)