File tree Expand file tree Collapse file tree 2 files changed +7
-6
lines changed
packages/respect-core/src/utils Expand file tree Collapse file tree 2 files changed +7
-6
lines changed Original file line number Diff line number Diff line change
1
+ ---
2
+ " @redocly/respect-core " : patch
3
+ " @redocly/openapi-core " : patch
4
+ " @redocly/cli " : patch
5
+ ---
6
+
7
+ Fixed binary response data in ` Respect ` results by properly encoding as base64.
Original file line number Diff line number Diff line change 1
1
import { isBrowser } from '@redocly/openapi-core' ;
2
2
3
- /**
4
- * Converts an ArrayBuffer to base64 string in a cross-platform way
5
- * Works in Node.js, browser, and Tauri environments
6
- */
7
3
export function arrayBufferToBase64 ( buffer : ArrayBuffer ) : string {
8
4
if ( isBrowser ) {
9
- // Browser environment - use built-in btoa with Uint8Array
10
5
const bytes = new Uint8Array ( buffer ) ;
11
6
let binary = '' ;
12
7
for ( let i = 0 ; i < bytes . byteLength ; i ++ ) {
13
8
binary += String . fromCharCode ( bytes [ i ] ) ;
14
9
}
15
10
return btoa ( binary ) ;
16
11
} else {
17
- // Node.js environment - use Buffer
18
12
return Buffer . from ( buffer ) . toString ( 'base64' ) ;
19
13
}
20
14
}
You can’t perform that action at this time.
0 commit comments