Skip to content

Commit f251497

Browse files
authored
Avoid using accidental public API (#47)
Motivation: NIOs underscored Base64 module accidentally leaked some public API as extensions on `String`. We shouldn't use these. Modifications: - Vend base64 encoding - Use it instead of NIOs API Result: Avoid using accidentally public API
1 parent 7b9b6f3 commit f251497

File tree

3 files changed

+758
-1
lines changed

3 files changed

+758
-1
lines changed

NOTICES.txt

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
The gRPC Swift Project
2+
======================
3+
4+
Copyright 2024 The gRPC Swift Project
5+
6+
The gRPC Swift project licenses this file to you under the Apache License,
7+
version 2.0 (the "License"); you may not use this file except in compliance
8+
with the License. You may obtain a copy of the License at:
9+
10+
https://www.apache.org/licenses/LICENSE-2.0
11+
12+
Unless required by applicable law or agreed to in writing, software
13+
distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
14+
WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
15+
License for the specific language governing permissions and limitations
16+
under the License.
17+
18+
-------------------------------------------------------------------------------
19+
20+
This product uses derivations of swift-extras/swift-extras-base64 'Base64.swift'.
21+
22+
* LICENSE (Apache License 2.0):
23+
* https://github.com/swift-extras/swift-extras-base64/blob/main/LICENSE
24+
* HOMEPAGE:
25+
* https://github.com/swift-extras/swift-extras-base64

Sources/GRPCNIOTransportCore/GRPCStreamStateMachine.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1866,7 +1866,7 @@ extension Metadata {
18661866
for header in headers {
18671867
if header.name.hasSuffix("-bin") {
18681868
do {
1869-
let decodedBinary = try header.value.base64Decoded()
1869+
let decodedBinary = try Base64.decode(string: header.value)
18701870
metadata.addBinary(decodedBinary, forKey: header.name)
18711871
} catch {
18721872
metadata.addString(header.value, forKey: header.name)

0 commit comments

Comments
 (0)