@@ -23,7 +23,7 @@ class SubmitPartRegularUploadOperation: BaseOperation<HTTPURLResponse>, SubmitPa
23
23
24
24
private var uploadRequest : UploadRequest ?
25
25
26
- private lazy var data : Data = descriptor. reader. sync {
26
+ private lazy var data : Data ? = descriptor. reader. sync {
27
27
descriptor. reader. seek ( position: offset)
28
28
29
29
return descriptor. reader. read ( amount: size)
@@ -39,6 +39,12 @@ class SubmitPartRegularUploadOperation: BaseOperation<HTTPURLResponse>, SubmitPa
39
39
40
40
super. init ( )
41
41
}
42
+
43
+ override func finish( with result: BaseOperation < HTTPURLResponse > . Result ) {
44
+ data = nil
45
+
46
+ super. finish ( with: result)
47
+ }
42
48
}
43
49
44
50
// MARK: - Operation Overrides
@@ -97,9 +103,10 @@ private extension SubmitPartRegularUploadOperation {
97
103
return
98
104
}
99
105
100
- guard let url = url ( from: response) ,
106
+ guard let data = data,
107
+ let url = url ( from: response) ,
101
108
let headers = headers ( from: response) ,
102
- let request = UploadService . shared. upload ( data: data, to: url, method: . put, headers: headers)
109
+ let request = UploadService . shared. upload ( data: data, to: url, method: . put, headers: headers)
103
110
else {
104
111
finish ( with: . failure( . unknown) )
105
112
return
@@ -129,6 +136,8 @@ private extension SubmitPartRegularUploadOperation {
129
136
}
130
137
131
138
func payload( ) -> Data ? {
139
+ guard let data = data else { return nil }
140
+
132
141
let payload : [ String : Any ] = [
133
142
" apikey " : descriptor. config. apiKey,
134
143
" uri " : descriptor. uri,
0 commit comments