Skip to content

Commit 57c0d44

Browse files
authored
Merge branch 'main' into liveActivity
2 parents 6b7a435 + 41cb4d5 commit 57c0d44

File tree

6 files changed

+73
-2
lines changed

6 files changed

+73
-2
lines changed

.github/workflows/release.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ on:
44
types: [published]
55
env:
66
CI_XCODE_14: '/Applications/Xcode_14.3.1.app/Contents/Developer'
7-
CI_XCODE_LATEST: '/Applications/Xcode_16.1.app/Contents/Developer'
7+
CI_XCODE_LATEST: '/Applications/Xcode_16.2.app/Contents/Developer'
88

99
jobs:
1010
cocoapods:

CHANGELOG.md

+8-1
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,16 @@
22
# Parse-Swift Changelog
33

44
### main
5-
[Full Changelog](https://github.com/netreconlab/Parse-Swift/compare/5.11.3...main), [Documentation](https://swiftpackageindex.com/netreconlab/Parse-Swift/main/documentation/parseswift)
5+
[Full Changelog](https://github.com/netreconlab/Parse-Swift/compare/5.11.4...main), [Documentation](https://swiftpackageindex.com/netreconlab/Parse-Swift/main/documentation/parseswift)
66
* _Contributing to this repo? Add info about your change here to be included in the next release_
77

8+
### 5.11.4
9+
[Full Changelog](https://github.com/netreconlab/Parse-Swift/compare/5.11.3...5.11.4), [Documentation](https://swiftpackageindex.com/netreconlab/Parse-Swift/5.11.4/documentation/parseswift)
10+
11+
__Fixes__
12+
* Encode plus symbol in query parameter URI's to server ([#191](https://github.com/netreconlab/Parse-Swift/pull/191)), thanks to [Corey Baker](https://github.com/cbaker6).
13+
* Encode Firebase notification keys correctly ([#187](https://github.com/netreconlab/Parse-Swift/pull/187)), thanks to [Corey Baker](https://github.com/cbaker6).
14+
815
### 5.11.3
916
[Full Changelog](https://github.com/netreconlab/Parse-Swift/compare/5.11.2...5.11.3), [Documentation](https://swiftpackageindex.com/netreconlab/Parse-Swift/5.11.3/documentation/parseswift)
1017

Sources/ParseSwift/API/API+Command.swift

+5
Original file line numberDiff line numberDiff line change
@@ -276,6 +276,11 @@ internal extension API {
276276
return
277277
}
278278
components.queryItems = params
279+
components.percentEncodedQuery = components.percentEncodedQuery?
280+
.replacingOccurrences(
281+
of: "+",
282+
with: "%2B"
283+
)
279284

280285
guard let urlComponents = components.url else {
281286
let error = ParseError(code: .otherCause,

Sources/ParseSwift/API/API+NonParseBodyCommand.swift

+5
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,11 @@ internal extension API {
7878
message: "Could not unwrap url components for \(url)"))
7979
}
8080
components.queryItems = params
81+
components.percentEncodedQuery = components.percentEncodedQuery?
82+
.replacingOccurrences(
83+
of: "+",
84+
with: "%2B"
85+
)
8186

8287
guard let urlComponents = components.url else {
8388
return .failure(ParseError(code: .otherCause,

Sources/ParseSwift/LiveQuery/ParseLiveQuery.swift

+5
Original file line numberDiff line numberDiff line change
@@ -154,6 +154,11 @@ Not attempting to open ParseLiveQuery socket anymore
154154
throw error
155155
}
156156
components.scheme = (components.scheme == "https" || components.scheme == "wss") ? "wss" : "ws"
157+
components.percentEncodedQuery = components.percentEncodedQuery?
158+
.replacingOccurrences(
159+
of: "+",
160+
with: "%2B"
161+
)
157162
url = components.url
158163
self.task = await URLSession.liveQuery.createTask(self.url,
159164
taskDelegate: self)

Tests/ParseSwiftTests/APICommandTests.swift

+49
Original file line numberDiff line numberDiff line change
@@ -407,6 +407,55 @@ class APICommandTests: XCTestCase {
407407
}
408408
}
409409

410+
func testQueryWhereEncoding() async throws {
411+
let query = Level.query("name" == "[email protected]")
412+
let parameters = try query.getQueryParameters()
413+
414+
let queryCommand = API.NonParseBodyCommand<Query<Level>, Level?>(
415+
method: .GET,
416+
path: query.endpoint,
417+
params: parameters
418+
) { _ in
419+
return nil
420+
}
421+
422+
switch await queryCommand.prepareURLRequest(options: []) {
423+
424+
case .success(let request):
425+
XCTAssertEqual(
426+
request.url?.absoluteString,
427+
"http://localhost:1337/parse/classes/Level?limit=100&skip=0&where=%7B%22name%22:%[email protected]%22%7D"
428+
)
429+
case .failure(let error):
430+
XCTFail(error.localizedDescription)
431+
}
432+
}
433+
434+
func testQueryWhereEncodingPlus() async throws {
435+
let query = Level.query("name" == "[email protected]")
436+
let parameters = try query.getQueryParameters()
437+
438+
let queryCommand = API.NonParseBodyCommand<Query<Level>, Level?>(
439+
method: .GET,
440+
path: query.endpoint,
441+
params: parameters
442+
) { _ in
443+
return nil
444+
}
445+
446+
switch await queryCommand.prepareURLRequest(options: []) {
447+
448+
case .success(let request):
449+
XCTAssertEqual(
450+
request.url?.absoluteString,
451+
// swiftlint:disable:next line_length
452+
"http://localhost:1337/parse/classes/Level?limit=100&skip=0&where=%7B%22name%22:%22test%[email protected]%22%7D"
453+
)
454+
case .failure(let error):
455+
XCTFail(error.localizedDescription)
456+
}
457+
}
458+
410459
func testClientKeyHeader() async throws {
411460
guard let clientKey = ParseSwift.configuration.clientKey else {
412461
throw ParseError(code: .otherCause, message: "Parse configuration should contain key")

0 commit comments

Comments
 (0)