@@ -133,17 +133,14 @@ export const Formatters: { [key in ViewableContentType]: Formatter } = {
133133 isEditApplicable : false ,
134134 render : ( input : Buffer , headers ?: Headers ) => {
135135 if ( input . byteLength < 10_000 ) {
136- const inputAsString = bufferToString ( input ) ;
137-
138136 try {
139137 let records = new Array ( ) ;
140- jsonRecordsSeparators . forEach ( ( separator ) => {
141- splitBuffer ( input , separator ) . forEach ( ( recordBuffer : Buffer ) => {
142- if ( recordBuffer . length > 0 ) {
143- const record = recordBuffer . toString ( 'utf-8' ) ;
144- records . push ( JSON . parse ( record . trim ( ) ) ) ;
145- }
146- } ) ;
138+ const separator = input [ input . length - 1 ] ;
139+ splitBuffer ( input , separator ) . forEach ( ( recordBuffer : Buffer ) => {
140+ if ( recordBuffer . length > 0 ) {
141+ const record = recordBuffer . toString ( 'utf-8' ) ;
142+ records . push ( JSON . parse ( record . trim ( ) ) ) ;
143+ }
147144 } ) ;
148145 // For short-ish inputs, we return synchronously - conveniently this avoids
149146 // showing the loading spinner that churns the layout in short content cases.
@@ -155,7 +152,7 @@ export const Formatters: { [key in ViewableContentType]: Formatter } = {
155152 // ^ Same logic as in UI-worker-formatter
156153 } catch ( e ) {
157154 // Fallback to showing the raw un-formatted:
158- return inputAsString ;
155+ return bufferToString ( input ) ;
159156 }
160157 } else {
161158 return observablePromise (
0 commit comments