diff --git a/README.md b/README.md
index 64aa311..feb4103 100644
--- a/README.md
+++ b/README.md
@@ -1,13 +1,12 @@
# aurelia-path
[![npm Version](https://img.shields.io/npm/v/aurelia-path.svg)](https://www.npmjs.com/package/aurelia-path)
-[![ZenHub](https://raw.githubusercontent.com/ZenHubIO/support/master/zenhub-badge.png)](https://zenhub.io)
[![Join the chat at https://gitter.im/aurelia/discuss](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/aurelia/discuss?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
[![CircleCI](https://circleci.com/gh/aurelia/path.svg?style=shield)](https://circleci.com/gh/aurelia/path)
This library is part of the [Aurelia](http://www.aurelia.io/) platform and contains utilities for path manipulation.
-> To keep up to date on [Aurelia](http://www.aurelia.io/), please visit and subscribe to [the official blog](http://blog.aurelia.io/) and [our email list](http://eepurl.com/ces50j). We also invite you to [follow us on twitter](https://twitter.com/aureliaeffect). If you have questions, please [join our community on Gitter](https://gitter.im/aurelia/discuss) or use [stack overflow](http://stackoverflow.com/search?q=aurelia). Documentation can be found [in our developer hub](http://aurelia.io/hub.html). If you would like to have deeper insight into our development process, please install the [ZenHub](https://zenhub.io) Chrome or Firefox Extension and visit any of our repository's boards.
+> To keep up to date on [Aurelia](http://www.aurelia.io/), please visit and subscribe to [the official blog](http://blog.aurelia.io/) and [our email list](http://eepurl.com/ces50j). We also invite you to [follow us on twitter](https://twitter.com/aureliaeffect). If you have questions, please [join our community on Gitter](https://gitter.im/aurelia/discuss) or use [stack overflow](http://stackoverflow.com/search?q=aurelia). Documentation can be found [in our developer hub](http://aurelia.io/hub.html).
## Platform Support
diff --git a/bower.json b/bower.json
index 2b2814a..8268874 100644
--- a/bower.json
+++ b/bower.json
@@ -1,6 +1,6 @@
{
"name": "aurelia-path",
- "version": "1.1.3",
+ "version": "1.1.4",
"description": "Utilities for path manipulation.",
"keywords": [
"aurelia",
diff --git a/doc/CHANGELOG.md b/doc/CHANGELOG.md
index e0f84cf..985f287 100644
--- a/doc/CHANGELOG.md
+++ b/doc/CHANGELOG.md
@@ -1,3 +1,13 @@
+
+## [1.1.4](https://github.com/aurelia/path/compare/1.1.2...1.1.4) (2019-03-26)
+
+
+### Bug Fixes
+
+* **all:** change es2015 back to native-modules ([3a13e2f](https://github.com/aurelia/path/commit/3a13e2f))
+
+
+
## [1.1.3](https://github.com/aurelia/path/compare/1.1.2...1.1.3) (2019-02-04)
diff --git a/package.json b/package.json
index 49127ae..ce2ce8e 100644
--- a/package.json
+++ b/package.json
@@ -1,6 +1,6 @@
{
"name": "aurelia-path",
- "version": "1.1.3",
+ "version": "1.1.4",
"description": "Utilities for path manipulation.",
"keywords": [
"aurelia",
diff --git a/src/index.js b/src/index.js
index 8941423..ca209c5 100644
--- a/src/index.js
+++ b/src/index.js
@@ -85,7 +85,14 @@ export function join(path1: string, path2: string): string {
for (let i = 0, ii = url1.length; i < ii; ++i) {
if (url1[i] === '..') {
- url3.pop();
+ // retain leading ..
+ // don't pop out previous ..
+ // retain consecutive ../../..
+ if (url3.length && url3[url3.length - 1] !== '..') {
+ url3.pop();
+ } else {
+ url3.push(url1[i]);
+ }
} else if (url1[i] === '.' || url1[i] === '') {
continue;
} else {
@@ -95,7 +102,11 @@ export function join(path1: string, path2: string): string {
for (let i = 0, ii = url2.length; i < ii; ++i) {
if (url2[i] === '..') {
- url3.pop();
+ if (url3.length && url3[url3.length - 1] !== '..') {
+ url3.pop();
+ } else {
+ url3.push(url2[i]);
+ }
} else if (url2[i] === '.' || url2[i] === '') {
continue;
} else {
diff --git a/test/path.spec.js b/test/path.spec.js
index e3fdbe1..d8066a3 100644
--- a/test/path.spec.js
+++ b/test/path.spec.js
@@ -171,6 +171,41 @@ describe('join', () => {
expect(join(path1, path2)).toBe('one');
});
+ it('should retain leading .. in path1', () => {
+ var path1 = '../one';
+ var path2 = './two';
+
+ expect(join(path1, path2)).toBe('../one/two');
+ });
+
+ it('should retain consecutive leading .. in path1', () => {
+ var path1 = '../../one';
+ var path2 = './two';
+
+ expect(join(path1, path2)).toBe('../../one/two');
+ });
+
+ it('should handle .. in path1 and path2', () => {
+ var path1 = '../../one';
+ var path2 = '../two';
+
+ expect(join(path1, path2)).toBe('../../two');
+ });
+
+ it('should merge .. in path1 and path2', () => {
+ var path1 = '../../one';
+ var path2 = '../../two';
+
+ expect(join(path1, path2)).toBe('../../../two');
+ });
+
+ it('should retain consecutive leading .. but not other .. in path1', () => {
+ var path1 = '../../one/../three';
+ var path2 = './two';
+
+ expect(join(path1, path2)).toBe('../../three/two');
+ });
+
it('should respect a trailing slash', () => {
var path1 = 'one/';
var path2 = 'two/';
@@ -236,7 +271,7 @@ describe('query strings', () => {
expect(gen({ obj: { a: 5, b: "str", c: false } })).toBe('obj%5Ba%5D=5&obj%5Bb%5D=str&obj%5Bc%5D=false');
expect(gen({ obj: { a: 5, b: "str", c: false } }, true)).toBe('obj=%5Bobject%20Object%5D');
expect(gen({ obj:{ a: 5, b: undefined}})).toBe('obj%5Ba%5D=5');
-
+
expect(gen({a: {b: ['c','d', ['f', 'g']]}})).toBe('a%5Bb%5D%5B%5D=c&a%5Bb%5D%5B%5D=d&a%5Bb%5D%5B2%5D%5B%5D=f&a%5Bb%5D%5B2%5D%5B%5D=g');
expect(gen({a: {b: ['c','d', ['f', 'g']]}}, true)).toBe('a=%5Bobject%20Object%5D');
expect(gen({a: ['c','d', ['f', 'g']]}, true)).toBe('a=c&a=d&a=f%2Cg');
@@ -260,14 +295,14 @@ describe('query strings', () => {
expect(parse('a=b&c=d')).toEqual({ a: 'b', c: 'd' });
expect(parse('a=b&&c=d')).toEqual({ a: 'b', c: 'd' });
expect(parse('a=b&a=c')).toEqual({ a: ['b', 'c'] });
-
+
expect(parse('a=b&c=d=')).toEqual({ a: 'b', c: 'd' });
expect(parse('a=b&c=d==')).toEqual({ a: 'b', c: 'd' });
expect(parse('a=%26')).toEqual({ a: '&' });
expect(parse('%26=a')).toEqual({ '&': 'a' });
expect(parse('%26[]=b&%26[]=c')).toEqual({ '&': ['b', 'c'] });
-
+
expect(parse('a[b]=c&a[d]=e')).toEqual({a: {b: 'c', d: 'e'}});
expect(parse('a[b][c][d]=e')).toEqual({a: {b: {c: {d: 'e'}}}});
expect(parse('a[b][]=c&a[b][]=d&a[b][2][]=f&a[b][2][]=g')).toEqual({a: {b: ['c','d', ['f', 'g']]}});