mirror of
https://github.com/EGroupware/egroupware.git
synced 2025-08-09 16:35:02 +02:00
Api: Fix favorites with non-ascii names could overlap
This commit is contained in:
@ -338,6 +338,20 @@ egw.extend('utils', egw.MODULE_GLOBAL, function()
|
||||
return _comp.replace(/%/g,'%25').replace(/#/g,'%23').replace(/\?/g,'%3F').replace(/\//g,'');
|
||||
},
|
||||
|
||||
/**
|
||||
* Hash a string
|
||||
*
|
||||
* @param string
|
||||
*/
|
||||
async hashString(string)
|
||||
{
|
||||
const data = (new TextEncoder()).encode(string);
|
||||
const hashBuffer = await crypto.subtle.digest('SHA-256', data);
|
||||
const hashArray = Array.from(new Uint8Array(hashBuffer));
|
||||
const hashHex = hashArray.map(byte => byte.toString(16).padStart(2, '0')).join('');
|
||||
return hashHex;
|
||||
},
|
||||
|
||||
/**
|
||||
* Escape HTML special chars, just like PHP
|
||||
*
|
||||
|
Reference in New Issue
Block a user