Skip to content

Commit

Permalink
Fix brave/brave-ios#8035: Add itms-apps, itms-appss and itmss t…
Browse files Browse the repository at this point in the history
…o the supported schemes (brave/brave-ios#8318)
  • Loading branch information
ns-vasilev authored Oct 26, 2023
1 parent 0e39b24 commit 8e8170c
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
2 changes: 1 addition & 1 deletion Sources/Shared/Extensions/URLExtensions.swift
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ extension URL {
}

// The list of permanent URI schemes has been taken from http://www.iana.org/assignments/uri-schemes/uri-schemes.xhtml
private let permanentURISchemes = ["aaa", "aaas", "about", "acap", "acct", "cap", "cid", "coap", "coaps", "crid", "data", "dav", "dict", "dns", "example", "file", "ftp", "geo", "go", "gopher", "h323", "http", "https", "iax", "icap", "im", "imap", "info", "ipp", "ipps", "iris", "iris.beep", "iris.lwz", "iris.xpc", "iris.xpcs", "jabber", "javascript", "ldap", "mailto", "mid", "msrp", "msrps", "mtqp", "mupdate", "news", "nfs", "ni", "nih", "nntp", "opaquelocktoken", "pkcs11", "pop", "pres", "reload", "rtsp", "rtsps", "rtspu", "service", "session", "shttp", "sieve", "sip", "sips", "sms", "snmp", "soap.beep", "soap.beeps", "stun", "stuns", "tag", "tel", "telnet", "tftp", "thismessage", "tip", "tn3270", "turn", "turns", "tv", "urn", "vemmi", "vnc", "ws", "wss", "xcon", "xcon-userid", "xmlrpc.beep", "xmlrpc.beeps", "xmpp", "z39.50r", "z39.50s"]
private let permanentURISchemes = ["aaa", "aaas", "about", "acap", "acct", "cap", "cid", "coap", "coaps", "crid", "data", "dav", "dict", "dns", "example", "file", "ftp", "geo", "go", "gopher", "h323", "http", "https", "iax", "icap", "im", "imap", "info", "ipp", "ipps", "iris", "iris.beep", "iris.lwz", "iris.xpc", "iris.xpcs", "itms-apps", "itms-appss", "itmss", "jabber", "javascript", "ldap", "mailto", "mid", "msrp", "msrps", "mtqp", "mupdate", "news", "nfs", "ni", "nih", "nntp", "opaquelocktoken", "pkcs11", "pop", "pres", "reload", "rtsp", "rtsps", "rtspu", "service", "session", "shttp", "sieve", "sip", "sips", "sms", "snmp", "soap.beep", "soap.beeps", "stun", "stuns", "tag", "tel", "telnet", "tftp", "thismessage", "tip", "tn3270", "turn", "turns", "tv", "urn", "vemmi", "vnc", "ws", "wss", "xcon", "xcon-userid", "xmlrpc.beep", "xmlrpc.beeps", "xmpp", "z39.50r", "z39.50s"]

private let ignoredSchemes = ["data"]
private let supportedSchemes = permanentURISchemes.filter { !ignoredSchemes.contains($0) }
Expand Down
7 changes: 5 additions & 2 deletions Tests/ClientTests/URLFormatTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,15 @@ import XCTest
checkValidURL("about:", afterFixup: "about:")
checkValidURL("about:config", afterFixup: "about:config")
checkValidURL("about: config", afterFixup: "about:%20config")

checkValidURL("file:///f/o/o", afterFixup: "file:///f/o/o")
checkValidURL("ftp://ftp.mozilla.org", afterFixup: "ftp://ftp.mozilla.org/")
checkValidURL("foo.bar", afterFixup: "http://foo.bar/")
checkValidURL(" foo.bar ", afterFixup: "http://foo.bar/")

checkValidURL("itms-apps://apps.apple.com/app/pulse-secure/id945832041", afterFixup: "itms-apps://apps.apple.com/app/pulse-secure/id945832041")
checkValidURL("itms-appss://apps.apple.com/app/pulse-secure/id945832041", afterFixup: "itms-appss://apps.apple.com/app/pulse-secure/id945832041")
checkValidURL("itmss://apps.apple.com/app/pulse-secure/id945832041", afterFixup: "itmss://apps.apple.com/app/pulse-secure/id945832041")

checkValidURL("[::1]:80", afterFixup: "http://[::1]/")
checkValidURL("[2a04:4e42:400::288]", afterFixup: "http://[2a04:4e42:400::288]/")
checkValidURL("[2a04:4e42:600::288]:80", afterFixup: "http://[2a04:4e42:600::288]/")
Expand Down

0 comments on commit 8e8170c

Please sign in to comment.