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-2591] URL.lastPathComponent returns garbage #3936

Closed
WFT opened this issue Sep 8, 2016 · 0 comments
Closed

[SR-2591] URL.lastPathComponent returns garbage #3936

WFT opened this issue Sep 8, 2016 · 0 comments

Comments

@WFT
Copy link

WFT commented Sep 8, 2016

Previous ID SR-2591
Radar None
Original Reporter @WFT
Type Bug
Status Resolved
Resolution Done

Attachment: Download

Environment

OS X El Capitan 10.11.6, Xcode 8 GM, Swift 3.0.

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

md5: 07fa77359cdddc75ce1ef832a3be15ab

Issue Description:

This code:

1> import Foundation
2> URL(string: "http://www.google.com")?.lastPathComponent

returns a garbage string, like in the screenshot attached.

This is also reproducible using NSURL in Swift 2.2, Xcode 7.3.1. I get an empty string when doing the same in Objective-C with the macOS 10.12 SDK:

@import Foundation;

void main() {
  NSString *s = [[NSURL URLWithString: @"http://www.google.com"] lastPathComponent];
  NSLog(@"%lu", (unsigned long)s.length);
  // Logs "0"
}

This may be related to SR-2581 which also seems to return a garbage string from a URL method, but I wasn't able to reproduce that issue in Swift 2.2.

@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
This issue was closed.
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

1 participant