mirror of
https://github.com/hashicorp/vault.git
synced 2025-12-25 11:21:11 +01:00
* license: update headers to IBM Corp. * `make proto` * update offset because source file changed Signed-off-by: Ryan Cragun <me@ryan.ec> Co-authored-by: Ryan Cragun <me@ryan.ec>
28 lines
625 B
JavaScript
28 lines
625 B
JavaScript
/**
|
|
* Copyright IBM Corp. 2016, 2025
|
|
* SPDX-License-Identifier: BUSL-1.1
|
|
*/
|
|
|
|
function encodePath(path) {
|
|
return path
|
|
? path
|
|
.split('/')
|
|
.map((segment) => encodeURIComponent(segment))
|
|
.join('/')
|
|
: path;
|
|
}
|
|
|
|
function normalizePath(path) {
|
|
// Unlike normalizePath from route-recognizer, this method assumes
|
|
// we do not have percent-encoded data octets as defined in
|
|
// https://datatracker.ietf.org/doc/html/rfc3986
|
|
return path
|
|
? path
|
|
.split('/')
|
|
.map((segment) => decodeURIComponent(segment))
|
|
.join('/')
|
|
: '';
|
|
}
|
|
|
|
export { normalizePath, encodePath };
|