Skip to content

Conversation

@will-velazquez
Copy link

This more closely aligns NSURL's parsing of path/query/fragment with Apple's

Tabs->Spaces, and fix incorrectly indented `if`
This is a bit odd, but on Apple's Foundation, we keep the original path string as-is, and then percent-encode on `absoluteURL`
This leaves invalid %-encodings like %98 in the string
Odd, but it's how `-[NSURL path]` behaves on Apple's Foundation
I'm not seeing the described behaviour of sometimes returning nil. If that's true for some URL's, let's please document so
For example:

```objc
    NSURL *url = [NSURL URLWithString: @"sms://open?something/message-guid=aa-bb-cc;frfrfr#foobar"];

    XCTAssertEqualObjects(@"sms", [url scheme]);
    XCTAssertEqualObjects(@"open", [url host]);
    XCTAssertEqualObjects(@"", [url path]);
    XCTAssertEqualObjects(@"something/message-guid=aa-bb-cc;frfrfr", [url query]);
    XCTAssertEqualObjects(@"foobar", [url fragment]);
```
Some characters are kept as %-escapes, while others are not. There's also handling for invalid %-encodings that may spring up
@will-velazquez will-velazquez marked this pull request as draft January 8, 2025 00:05
@will-velazquez
Copy link
Author

will-velazquez commented Jan 8, 2025

This is causing issues with some file: URL's, drafting while I fix that and add tests fixed -it was keeping \'s encoded as %5C

This fixes certain file: URL's on Windows
@will-velazquez will-velazquez marked this pull request as ready for review January 8, 2025 01:07
@will-velazquez will-velazquez marked this pull request as draft January 8, 2025 14:34
@will-velazquez
Copy link
Author

This seems to be affecting "sign in with google" as well

Some requested scopes were invalid. {invalid=[https://www.googleapis.com/auth/userinfo.email%20https://www.googleapis.com/auth/userinfo.profile%20https://www.googleapis.com/auth/calendar%20https://www.googleapis.com/auth/tasks%20https://www.googleapis.com/auth/contacts.readonly%20https://www.googleapis.com/auth/contacts.other.readonly%20https://www.googleapis.com/auth/drive.file]}

@will-velazquez will-velazquez force-pushed the master branch 4 times, most recently from 276a05b to 3a61d74 Compare September 11, 2025 19:32
@will-velazquez will-velazquez force-pushed the master branch 6 times, most recently from 1748252 to 72973f6 Compare October 30, 2025 19:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants