Skip to content

Commit 4dcf345

Browse files
authored
fix: replace buffer decoding with atob (#2808)
1 parent 5ecaba8 commit 4dcf345

1 file changed

Lines changed: 1 addition & 3 deletions

File tree

src/utils/fetchData.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import { Platform } from 'react-native';
2-
import { Buffer } from 'buffer';
32

43
export async function fetchText(uri?: string): Promise<string | null> {
54
if (!uri) {
@@ -17,10 +16,9 @@ export async function fetchText(uri?: string): Promise<string | null> {
1716
const decodeBase64Image = (uri: string) => {
1817
const decoded = decodeURIComponent(uri);
1918
const splitContent = decoded.split(';')[1].split(',');
20-
const dataType = splitContent[0] as BufferEncoding;
2119
const content = splitContent.slice(1).join(',');
2220

23-
return Buffer.from(content, dataType).toString('utf-8');
21+
return atob(content);
2422
};
2523

2624
function dataUriToXml(uri: string): string | null {

0 commit comments

Comments
 (0)