Skip to content

Commit 8d96c33

Browse files
committed
Encoding artist names
1 parent 3475e5c commit 8d96c33

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

Source/ArtistsRouter.swift

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,9 +32,11 @@ extension Router {
3232
case .Index:
3333
return "/artists"
3434
case .Show(let name):
35-
return "/artists/\(name)"
35+
let escapedName = name.stringByAddingPercentEncodingWithAllowedCharacters(NSCharacterSet.URLPathAllowedCharacterSet())!
36+
return "/artists/\(escapedName)"
3637
case .ShowTracks(let name, _):
37-
return "/artists/\(name)/tracks"
38+
let escapedName = name.stringByAddingPercentEncodingWithAllowedCharacters(NSCharacterSet.URLPathAllowedCharacterSet())!
39+
return "/artists/\(escapedName)/tracks"
3840
}
3941
}
4042

0 commit comments

Comments
 (0)