Skip to content

Commit

Permalink
Fix a normalization bug. (#26)
Browse files Browse the repository at this point in the history
Closes #24
  • Loading branch information
nex3 committed Jun 8, 2017
1 parent 0bb73f1 commit 9175474
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 2 deletions.
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

0 comments on commit 9175474

Please sign in to comment.