Files
dspace-angular/src/app/shared/utils/encode-decode.util.ts
2018-05-29 10:51:07 +02:00

11 lines
377 B
TypeScript

/**
* use this to make a Base64 encoded string URL friendly,
* i.e. '+' and '/' are replaced with special percent-encoded hexadecimal sequences
*
* @param {String} str the encoded string
* @returns {String} the URL friendly encoded String
*/
export function Base64EncodeUrl(str): string {
return str.replace(/\+/g, '%2B').replace(/\//g, '%2F').replace(/\=/g, '%3D');
}