Skip to content

Commit

Permalink
Merge pull request #2496 from Mov1s/issue/2493-url-characters-in-deri…
Browse files Browse the repository at this point in the history
…ved-data-path

Sanitizing dependency names
  • Loading branch information
mdiep committed Jun 21, 2018
2 parents 5b8965e + 0e56719 commit e0d2498
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
3 changes: 2 additions & 1 deletion Source/CarthageKit/GitURL.swift
Expand Up @@ -52,7 +52,8 @@ public struct GitURL {
return components
.last
.map(String.init)
.map(strippingGitSuffix)
.map(strippingGitSuffix)?
.removingPercentEncoding
}

public init(_ urlString: String) {
Expand Down
6 changes: 6 additions & 0 deletions Tests/CarthageKitTests/DependencySpec.swift
Expand Up @@ -78,6 +78,12 @@ class DependencySpec: QuickSpec {

expect(dependency.name) == "myproject"
}

it("should have percent encoding removed") {
let dependency = Dependency.git(GitURL("ssh://server.com/my%20project%20with%20spaces.git"))

expect(dependency.name) == "my project with spaces"
}

it("should be the entire URL string if there is no last component") {
let dependency = Dependency.git(GitURL("whatisthisurleven"))
Expand Down

0 comments on commit e0d2498

Please sign in to comment.