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

Make URL strategy better at recognizing URLs. #873

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

lrhn
Copy link
Member

@lrhn lrhn commented Mar 25, 2025

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 ?, 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 /.

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

lrhn added 2 commits March 24, 2025 16:08
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 `/`.
@lrhn lrhn requested a review from natebosch March 25, 2025 14:27
Copy link

PR Health

Breaking changes ✔️
Package Change Current Version New Version Needed Version Looking good?
path None 1.9.1 1.9.2-wip 1.9.1 ✔️
Changelog Entry ✔️
Package Changed Files

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.
Copy link
Member

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
Copy link
Member

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.

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.

join() not working as advertised
2 participants