Skip to content
This repository has been archived by the owner on Mar 6, 2024. It is now read-only.

Commit

Permalink
Fix url encoding (#3949)
Browse files Browse the repository at this point in the history
(cherry picked from commit c43e34e)
  • Loading branch information
OrlaM authored and rvandermeulen committed Dec 13, 2023
1 parent bc464d6 commit 16df826
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 9 deletions.
2 changes: 1 addition & 1 deletion Blockzilla/Utilities/URIFixup.swift
Expand Up @@ -7,7 +7,7 @@ import Foundation
class URIFixup {
static func getURL(entry: String) -> URL? {
let trimmed = entry.trimmingCharacters(in: CharacterSet.whitespacesAndNewlines)
guard let escaped = trimmed.addingPercentEncoding(withAllowedCharacters: CharacterSet.alphanumerics) else {
guard let escaped = trimmed.addingPercentEncoding(withAllowedCharacters: CharacterSet.urlAllowed) else {
return nil
}

Expand Down
8 changes: 0 additions & 8 deletions focus-ios/ClientTests/URIFixupTests.swift
Expand Up @@ -48,7 +48,6 @@ class URIFixupTests: XCTestCase {
"http://moz.fir/?q=Test%20URL-encoded%20fire",
"http://مثال.إختبار",
"http://王涵.王涵",
"http://-.~_!$&'()*+,;=:%40:80%2f::::::@mozilla.org",
"http://6662.net",
"http://f.i-r.ef",
"http://266.315.245.345",
Expand All @@ -74,13 +73,6 @@ class URIFixupTests: XCTestCase {
}
}

func testValidURLsForNoSchemes() {
httpSchemeURLs.forEach {
let noSchemeURL = $0.replacingOccurrences(of: "http", with: "")
XCTAssertNotNil(URIFixup.getURL(entry: noSchemeURL), "\(noSchemeURL) is not a valid URL")
}
}

func testCustomSchemes() {
customSchemeURLs.forEach {
XCTAssertNotNil(URIFixup.getURL(entry: $0), "\($0) is not a valid URL")
Expand Down

0 comments on commit 16df826

Please sign in to comment.