-
Notifications
You must be signed in to change notification settings - Fork 17
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
Make URL strategy better at recognizing URLs. #873
base: main
Are you sure you want to change the base?
Conversation
More precise scheme detection, more precise authority detection, more precise drive-letter detection. Generally recognizes that a path ends at `#` or `?`, and doesn't parse into that. Recognizes only valid schemes as schemes. Ends authority at `/`, `#` or `?` or end-of-path, not just at `/`. Allows drive letter ended by `#` or `?` or end-of-path, not just `/`.
PR HealthBreaking changes ✔️
Changelog Entry ✔️
Changes to files need to be accounted for in their respective changelogs.
Coverage
|
File | Coverage |
---|---|
pkgs/path/lib/src/characters.dart | 💔 Not covered |
pkgs/path/lib/src/context.dart | 💔 98 % ⬇️ 0 % |
pkgs/path/lib/src/internal_style.dart | 💚 100 % |
pkgs/path/lib/src/parsed_path.dart | 💚 100 % |
pkgs/path/lib/src/style/url.dart | 💚 95 % ⬆️ 1 % |
pkgs/path/lib/src/utils.dart | 💚 98 % ⬆️ 5 % |
This check for test coverage is informational (issues shown here will not fail the PR).
This check can be disabled by tagging the PR with skip-coverage-check
.
API leaks ⚠️
The following packages contain symbols visible in the public API, but not exported by the library. Export these symbols or remove them from your publicly visible API.
Package | Leaked API symbols |
---|---|
path | InternalStyle |
This check can be disabled by tagging the PR with skip-leaking-check
.
License Headers ✔️
// Copyright (c) 2025, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
Files |
---|
no missing headers |
All source files should start with a license header.
// Empty paths are normalized to ".". | ||
if (path.isEmpty) return true; | ||
|
||
/// At start, no previous separator. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[nit] Replace ///
with //
inside the method. It's all at the same level of indentation. s\^ ///\ //\
/// URL-formatted path, or `null` if [index] is not the start of a drive letter. | ||
/// A valid drive letter must be followed by a colon and then either a `/` or | ||
/// the end of string. | ||
/// Index after drive letter starting at [index], or [index] if none.path |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[nit] extra characters after the period.
More precise scheme detection, more precise authority detection,
more precise drive-letter detection. More URL-like behavior.
Generally recognizes that a path ends at
#
or?
, anddoesn't parse into that.
Recognizes only valid schemes as schemes.
Ends authority at
/
,#
or?
or end-of-path, not just at/
.Allows drive letter ended by
#
or?
or end-of-path, not just/
.Combines everything from the first
?
or#
in the last path segment.(Which may give weird results if you join onto that, but works fine with
dirname
.)Fixes #546