Navigation Menu

Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[SR-2252] Making URL.resourceSpecifier unavailable makes mailto: URLs unusable #4124

Open
beccadax opened this issue Aug 2, 2016 · 4 comments

Comments

@beccadax
Copy link
Contributor

beccadax commented Aug 2, 2016

Previous ID SR-2252
Radar None
Original Reporter @beccadax
Type Bug
Environment

Xcode 8 beta 4 (swiftlang-800.0.41.2), OS X 10.11.5 (15F34)

Additional Detail from JIRA
Votes 1
Component/s Foundation
Labels Bug, SDKOverlay
Assignee None
Priority Medium

md5: 814ae571937761d91f55e39691ec4779

Issue Description:

The Foundation overlay included with Xcode 8 beta 4 (swiftlang-800.0.41.2) marks the `resourceSpecifier` as "Unavailable" with the message "Use `path`, `query`, and `fragment` instead". However, when initialized with a `mailto` URL, none of these properties contains the email address. In fact, if you paste the following code into a REPL, you'll notice that no property contains the email address without the "mailto:" prefix:

import Foundation
let url = URL(string: "mailto:test@example.com")!
dump(url.absoluteString)
dump(url.relativeString)
dump(url.baseURL)
dump(url.absoluteURL)
dump(url.scheme)
dump(url.host)
dump(url.port)
dump(url.user)
dump(url.password)
dump(url.path)
dump(url.relativePath)
dump(url.fragment)
dump(url.query)

The relevant commit seems to be <apple/swift@05778cc9aba3eab2576786e4008a7bce0e0d43b9\>.

@swift-ci
Copy link
Contributor

Comment by David Liu (JIRA)

please update and check again this issue seems resolved resourceSpecifier is part of the working API

Edit:
Nvm Brent you are correct this is still an issue with the Overlay

@swift-ci
Copy link
Contributor

Comment by John Jacob Jingleheimer Schmidt (JIRA)

I believe that `path` should contain the mail address in this case, according to RFC 3986. But it seems like URL doesn't recognize any path that doesn't begin with / (forward slash), even though the RFC only requires a beginning slash for URIs that include an authority component.

@swift-ci
Copy link
Contributor

swift-ci commented Apr 1, 2020

Comment by Charlie Monroe (JIRA)

There seems to be a discrepency between URL and URLComponents:

let url = URL(string: "mailto:test@example.com")!
url.path // ""

let components = URLComponents(url: url, resolvingAgainstBaseURL: false)!
components.path // mailto:test@example.com

@swift-ci swift-ci transferred this issue from apple/swift-issues Apr 25, 2022
@shahmishal shahmishal transferred this issue from apple/swift May 5, 2022
@futuretap
Copy link

Is there a particular reason why resourceSpecifier is unavailable? Seems like a strange regression.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants