Skip to content

URL directory hints#121

Draft
dfabulich wants to merge 3 commits intoskiptools:mainfrom
dfabulich:url-directory-hints
Draft

URL directory hints#121
dfabulich wants to merge 3 commits intoskiptools:mainfrom
dfabulich:url-directory-hints

Conversation

@dfabulich
Copy link
Copy Markdown
Contributor

@dfabulich dfabulich commented Apr 27, 2026

This is a stacked PR

Fixes #120

While testing it, I discovered a lot of bizarre legacy behavior that I tried to copy as best I could, e.g. for directories, .path returns /foo but absoluteString returns file:///foo/.

I've also kept Skip's existing behavior not to use the legacy .checkFileSystem behavior by default for the deprecated legacy init(fileURLWithPath:) constructor and appendingPathComponent(_:) methods. For now, they use .inferFromPath by default instead.

Skip Pull Request Checklist:

  • REQUIRED: I have signed the Contributor Agreement
  • REQUIRED: I have tested my change locally with swift test
  • OPTIONAL: I have tested my change on an iOS simulator or device
  • OPTIONAL: I have tested my change on an Android emulator or device

  • AI was used to generate or assist with generating this PR. Please specify below how you used AI to help you, and what steps you have taken to manually verify the changes.

Cursor generated a lot of tests, and a lot of bad code, which I mostly rewrote. The tests confirm that the behavior here matches native Swift Foundation.

1. Fixed `CharacterSet.urlHostAllowed`, `urlPathAllowed`, and `urlQueryAllowed`, all of which mismatched native Swift

2. `URLComponents.string` returned an unencoded query string, which `java.net.URI` failed to parse, forcing us into a fallback where we re-encoded the items and passed them to OkHttp, which stripped out `%0A` newlines. Now, we add percent encoding in `URLComponents.string`, so no fallback is necessary.
@cla-bot cla-bot Bot added the cla-signed label Apr 27, 2026
@dfabulich
Copy link
Copy Markdown
Contributor Author

skip test --filter TestURL was a huge help here!

@dfabulich dfabulich force-pushed the url-directory-hints branch 2 times, most recently from c2649c3 to 6faaba8 Compare April 27, 2026 07:16
Fixes skiptools#120

While testing it, I discovered a lot of bizarre legacy behavior that I tried to copy as best I could, e.g. for directories, `.path` returns `/foo` but `absoluteString` returns `file:///foo/`.

I've also kept Skip's existing behavior not to use the legacy `.checkFileSystem` behavior by default for the deprecated legacy `init(fileURLWithPath:)` constructor and `appendingPathComponent(_:)` methods. For now, they use `.inferFromPath` by default instead.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add support for URL directory hints

1 participant