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

Detect library hrefs with or without ending slash. #1424

Merged
merged 2 commits into from
Nov 28, 2024

Conversation

isoos
Copy link
Collaborator

@isoos isoos commented Nov 26, 2024

This is assuming that the new href URLs in dartdoc will get an ending slash: dart-lang/dartdoc#3936

@isoos isoos requested review from jonasfj and sigurdm November 26, 2024 15:01
@@ -17,6 +17,7 @@ bool isHrefALibrary(String? href) {
if (href.endsWith('.html')) {
return false;
}
// libraries have no slash in their hrefs
return !href.contains('/');
final segments = href.split('/').where((s) => s.isNotEmpty).toList();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This also removes empty segments in the middle a//b->a/b is that ever a problem? should we test for an empty segment only at the end?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In this specific case, it would be considered as a bug in dartdoc, however, it doesn't hurt if we remove only the last one. Done.

@isoos isoos merged commit 87bd03e into dart-lang:master Nov 28, 2024
5 checks passed
@isoos isoos deleted the fix-slash branch November 28, 2024 07:24
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