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

Fix a normalization bug. #26

Merged
merged 1 commit into from Jun 8, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 4 additions & 0 deletions CHANGELOG.md
@@ -1,3 +1,7 @@
## 1.4.2

* Normalize `c:\foo\.` to `c:\foo`.

## 1.4.1

* Root-relative URLs like `/foo` are now resolved relative to the drive letter
Expand Down
2 changes: 1 addition & 1 deletion lib/src/context.dart
Expand Up @@ -397,7 +397,7 @@ class Context {
// Single dots and double dots are normalized to directory traversals.
if (previous == chars.PERIOD &&
(previousPrevious == null ||
previousPrevious == chars.SLASH ||
style.isSeparator(previousPrevious) ||
previousPrevious == chars.PERIOD)) {
return true;
}
Expand Down
2 changes: 1 addition & 1 deletion pubspec.yaml
@@ -1,5 +1,5 @@
name: path
version: 1.4.1
version: 1.4.2-dev
author: Dart Team <misc@dartlang.org>
description: >
A string-based path manipulation library. All of the path operations you know
Expand Down
2 changes: 2 additions & 0 deletions test/windows_test.dart
Expand Up @@ -330,6 +330,7 @@ main() {
test('eliminates "." parts', () {
expect(context.normalize(r'.\'), '.');
expect(context.normalize(r'c:\.'), r'c:\');
expect(context.normalize(r'c:\foo\.'), r'c:\foo');
expect(context.normalize(r'B:\.\'), r'B:\');
expect(context.normalize(r'\\server\share\.'), r'\\server\share');
expect(context.normalize(r'.\.'), '.');
Expand All @@ -351,6 +352,7 @@ main() {
expect(
context.normalize(r'\\server\share\..\../..\a'), r'\\server\share\a');
expect(context.normalize(r'c:\..'), r'c:\');
expect(context.normalize(r'c:\foo\..'), r'c:\');
expect(context.normalize(r'A:/..\..\..'), r'A:\');
expect(context.normalize(r'b:\..\..\..\a'), r'b:\a');
expect(context.normalize(r'b:\r\..\..\..\a\c\.\..'), r'b:\a');
Expand Down