Skip to content

Commit

Permalink
fix(server): support protocol free paths (#163)
Browse files Browse the repository at this point in the history
  • Loading branch information
patrickhaug authored and gregberge committed Nov 22, 2018
1 parent 5cdda81 commit 3b5b115
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
2 changes: 1 addition & 1 deletion packages/server/src/util.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,4 @@ export const smartRequire = modulePath => {
}

export const joinURLPath = (...paths) =>
paths.join('/').replace(/(?<!:)\/\//g, '/')
paths.join('/').replace(/(?<!http(s)?:)(?<=.)\/\//g, '/')
6 changes: 6 additions & 0 deletions packages/server/src/util.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,5 +16,11 @@ describe('util', () => {
`${publicPath}/style.css`,
)
})
it('should join paths with protocol free public path', () => {
const publicPath = '//127.0.0.1/public'
expect(joinURLPath(publicPath, 'style.css')).toBe(
`${publicPath}/style.css`,
)
})
})
})

0 comments on commit 3b5b115

Please sign in to comment.