mirror of
https://github.com/Alfresco/alfresco-content-app.git
synced 2025-05-26 17:24:45 +00:00
AAE-30880 Remove usage of commonjs buffer package (#4379)
* AAE-30880 Remove usage of commonjs buffer package * AAE-30880 Replace missing conversion with atob * AAE-30880 Utilize TextEncoder tool
This commit is contained in:
parent
6a5e894998
commit
5bd8357169
@ -22,8 +22,6 @@
|
|||||||
* from Hyland Software. If not, see <http://www.gnu.org/licenses/>.
|
* from Hyland Software. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { Buffer } from 'buffer';
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Checks if string is an AND or OR operator
|
* Checks if string is an AND or OR operator
|
||||||
*
|
*
|
||||||
@ -100,7 +98,7 @@ export function formatSearchTerm(userInput: string, fields = ['cm:name']): strin
|
|||||||
*/
|
*/
|
||||||
export function extractUserQueryFromEncodedQuery(encodedQuery: string): string {
|
export function extractUserQueryFromEncodedQuery(encodedQuery: string): string {
|
||||||
if (encodedQuery) {
|
if (encodedQuery) {
|
||||||
const decodedQuery: { [key: string]: any } = JSON.parse(Buffer.from(encodedQuery, 'base64').toString('utf-8'));
|
const decodedQuery: { [key: string]: any } = JSON.parse(new TextDecoder().decode(Uint8Array.from(atob(encodedQuery), (c) => c.charCodeAt(0))));
|
||||||
return decodedQuery.userQuery;
|
return decodedQuery.userQuery;
|
||||||
}
|
}
|
||||||
return '';
|
return '';
|
||||||
@ -136,7 +134,7 @@ export function extractSearchedWordFromEncodedQuery(encodedQuery: string): strin
|
|||||||
*/
|
*/
|
||||||
export function extractFiltersFromEncodedQuery(encodedQuery: string): any {
|
export function extractFiltersFromEncodedQuery(encodedQuery: string): any {
|
||||||
if (encodedQuery) {
|
if (encodedQuery) {
|
||||||
const decodedQuery = Buffer.from(encodedQuery, 'base64').toString('utf-8');
|
const decodedQuery = new TextDecoder().decode(Uint8Array.from(atob(encodedQuery), (c) => c.charCodeAt(0)));
|
||||||
return JSON.parse(decodedQuery);
|
return JSON.parse(decodedQuery);
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user