@@ -336,7 +336,7 @@ public final class GoogleCloudStorageObjectAPI: StorageObjectAPI {
336336 " destination " : destination,
337337 " sourceObjects " : sourceObjects]
338338 let requestBody = try JSONSerialization . data ( withJSONObject: body)
339- return request. send ( method: . POST, path: " \( endpoint) / \( bucket) /o/ \( destinationObject) /compose " , query: queryParams, body: . data( requestBody) )
339+ return request. send ( method: . POST, path: " \( endpoint) / \( bucket) /o/ \( destinationObject. replacingOccurrences ( of : " / " , with : " %2F " ) ) /compose " , query: queryParams, body: . data( requestBody) )
340340 } catch {
341341 return request. eventLoop. makeFailedFuture ( error)
342342 }
@@ -355,7 +355,7 @@ public final class GoogleCloudStorageObjectAPI: StorageObjectAPI {
355355
356356 do {
357357 let requestBody = try JSONSerialization . data ( withJSONObject: object)
358- return request. send ( method: . POST, path: " \( endpoint) / \( sourceBucket) /o/ \( sourceObject) /copyTo/b/ \( destinationBucket) /o/ \( destinationObject) " , query: queryParams, body: . data( requestBody) )
358+ return request. send ( method: . POST, path: " \( endpoint) / \( sourceBucket) /o/ \( sourceObject. replacingOccurrences ( of : " / " , with : " %2F " ) ) /copyTo/b/ \( destinationBucket) /o/ \( destinationObject. replacingOccurrences ( of : " / " , with : " %2F " ) ) " , query: queryParams, body: . data( requestBody) )
359359 } catch {
360360 return request. eventLoop. makeFailedFuture ( error)
361361 }
@@ -367,7 +367,7 @@ public final class GoogleCloudStorageObjectAPI: StorageObjectAPI {
367367 queryParams = queryParameters. queryParameters
368368 }
369369
370- return request. send ( method: . DELETE, path: " \( endpoint) / \( bucket) /o/ \( object) " , query: queryParams)
370+ return request. send ( method: . DELETE, path: " \( endpoint) / \( bucket) /o/ \( object. replacingOccurrences ( of : " / " , with : " %2F " ) ) " , query: queryParams)
371371 }
372372
373373 public func get( bucket: String , object: String , queryParameters: [ String : String ] ? ) -> EventLoopFuture < GoogleCloudStorageObject > {
@@ -376,7 +376,7 @@ public final class GoogleCloudStorageObjectAPI: StorageObjectAPI {
376376 queryParams = queryParameters. queryParameters
377377 }
378378
379- return request. send ( method: . GET, path: " \( endpoint) / \( bucket) /o/ \( object) " , query: queryParams)
379+ return request. send ( method: . GET, path: " \( endpoint) / \( bucket) /o/ \( object. replacingOccurrences ( of : " / " , with : " %2F " ) ) " , query: queryParams)
380380 }
381381
382382 public func getMedia( bucket: String , object: String , range: ClosedRange < Int > ? , queryParameters: [ String : String ] ? ) -> EventLoopFuture < GoogleCloudStorgeDataResponse > {
@@ -394,7 +394,7 @@ public final class GoogleCloudStorageObjectAPI: StorageObjectAPI {
394394 headers. add ( name: " Range " , value: " bytes= \( range. lowerBound) - \( range. upperBound) " )
395395 }
396396
397- return request. send ( method: . GET, headers: headers, path: " \( endpoint) / \( bucket) /o/ \( object) " , query: queryParams)
397+ return request. send ( method: . GET, headers: headers, path: " \( endpoint) / \( bucket) /o/ \( object. replacingOccurrences ( of : " / " , with : " %2F " ) ) " , query: queryParams)
398398 }
399399
400400 public func createSimpleUpload( bucket: String ,
@@ -460,7 +460,7 @@ public final class GoogleCloudStorageObjectAPI: StorageObjectAPI {
460460 do {
461461 let requestBody = try JSONSerialization . data ( withJSONObject: metadata)
462462 return request. send ( method: . POST,
463- path: " \( endpoint) / \( sourceBucket) /o/ \( sourceObject) /rewriteTo/b/ \( destinationBucket) /o/ \( destinationObject) " ,
463+ path: " \( endpoint) / \( sourceBucket) /o/ \( sourceObject. replacingOccurrences ( of : " / " , with : " %2F " ) ) /rewriteTo/b/ \( destinationBucket) /o/ \( destinationObject. replacingOccurrences ( of : " / " , with : " %2F " ) ) " ,
464464 query: queryParams,
465465 body: . data( requestBody) )
466466 } catch {
@@ -521,7 +521,7 @@ public final class GoogleCloudStorageObjectAPI: StorageObjectAPI {
521521
522522 do {
523523 let requestBody = try JSONSerialization . data ( withJSONObject: body)
524- return request. send ( method: . PUT, path: " \( endpoint) / \( bucket) /o/ \( object) " , query: queryParams, body: . data( requestBody) )
524+ return request. send ( method: . PUT, path: " \( endpoint) / \( bucket) /o/ \( object. replacingOccurrences ( of : " / " , with : " %2F " ) ) " , query: queryParams, body: . data( requestBody) )
525525 } catch {
526526 return request. eventLoop. makeFailedFuture ( error)
527527 }
0 commit comments