Skip to content

Commit

Permalink
add case insensitive to deeplinks
Browse files Browse the repository at this point in the history
  • Loading branch information
JonathanCuendetMindera committed Oct 21, 2020
1 parent f8e6f53 commit 7bf4433
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 11 deletions.
8 changes: 4 additions & 4 deletions Sources/DeepLinking/Route+TrieRouter.swift
Original file line number Diff line number Diff line change
Expand Up @@ -178,8 +178,8 @@ extension Route {
private func parseAnnotatedRoute(_ route: URL) throws -> [Route.Component] {

// use a wildcard for empty schemes/hosts, to match any scheme/host
let schemeComponent = route.scheme.constantOrWildcardComponent
let hostComponent = route.host.constantOrWildcardComponent
let schemeComponent = (route.scheme?.lowercased()).constantOrWildcardComponent
let hostComponent = (route.host?.lowercased()).constantOrWildcardComponent

do {
let pathComponents = try route.pathComponents.filter { $0 != "/" }.map(Route.Component.init(component:))
Expand All @@ -204,8 +204,8 @@ extension Route {
private func parseMatchRoute(_ route: URL) throws -> MatchRoute {

// use an empty string for empty scheme/host, to match wildcard scheme/host
let schemeComponent = route.scheme ?? ""
let hostComponent = route.host ?? ""
let schemeComponent = route.scheme?.lowercased() ?? ""
let hostComponent = route.host?.lowercased() ?? ""
let pathComponents = route.pathComponents.filter { $0 != "/" }

let routeComponents = [schemeComponent, hostComponent] + pathComponents
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,22 +57,22 @@ class Route_TrieRouter_DescriptionTests: XCTestCase {
XCTAssertEqual(
router.description,
"""
├──┬ schemeB
│ ├──┬ hostB
├──┬ schemeb
│ ├──┬ hosta
│ │ └──● AnyRouteHandler<String>(P)
│ │
│ ├──┬ hostb
│ │ └──┬ path
│ │ ├──┬ *
│ │ │ └──● AnyRouteHandler<String>(R)
│ │ │
│ │ └──● AnyRouteHandler<String>(Q)
│ │
│ ├──┬ hostA
│ │ └──● AnyRouteHandler<String>(P)
│ │
│ └──┬ *
│ └──● AnyRouteHandler<String>(O)
├──┬ schemeA
│ ├──┬ hostC
├──┬ schemea
│ ├──┬ hostc
│ │ └──┬ *
│ │ └──┬ yet
│ │ └──┬ another
Expand Down

0 comments on commit 7bf4433

Please sign in to comment.