Skip to content

Commit bf7da7b

Browse files
brennanMKEroyjit
authored andcommitted
chore(storage): strips quotes around eTag (#105)
1 parent 7dd1b68 commit bf7da7b

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed

AmplifyPlugins/Storage/AWSS3StoragePlugin/Support/Internal/URLSessionTask+eTag.swift

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,8 @@ import Foundation
99

1010
extension URLSessionTask {
1111
var eTag: String? {
12-
guard let httpResponse = response as? HTTPURLResponse else {
12+
guard let httpResponse = response as? HTTPURLResponse,
13+
httpResponse.statusCode == 200 else {
1314
return nil
1415
}
1516

@@ -18,10 +19,12 @@ extension URLSessionTask {
1819
.filter({ $0.uppercased() == "ETAG" })
1920

2021
guard let key = keys.first,
21-
let eTag = httpResponse.allHeaderFields[key] as? String else {
22+
let quotedValue = httpResponse.allHeaderFields[key] as? String else {
2223
return nil
2324
}
2425

26+
let eTag = quotedValue.replacingOccurrences(of: "\"", with: "")
27+
2528
return eTag
2629
}
2730
}

CHANGELOG.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
- **Core**: Amplify now directly depends on AWS SDK for Swift.
88
- **Auth**: Redesigned AWSCognitoAuthPlugin implementation using a state machine architecture. Internal dependency on AWSMobileClient is removed and the plugin directly depends on AWS SDK for Swift. The escape hatch now returns the underlying Swift SDK for Cognito UserPool and Cognito Identity Pool.
9-
- **Storage**: Removed the dependency on TransferUtility and improved the internal logic of AWSS3StoragePlugin implementation.
9+
- **Storage**: Removed the dependency on AWSTransferUtility and improved the internal logic of AWSS3StoragePlugin implementation.
1010

1111
## 1.21.0 (2022-02-23)
1212

0 commit comments

Comments
 (0)