File tree Expand file tree Collapse file tree 1 file changed +11
-20
lines changed Expand file tree Collapse file tree 1 file changed +11
-20
lines changed Original file line number Diff line number Diff line change @@ -93,31 +93,22 @@ class CoCreateFileSystem {
9393 var base64Data = src . replace ( / ^ d a t a : i m a g e \/ ( p n g | j p e g | j p g ) ; b a s e 6 4 , / , '' ) ;
9494 let file = Buffer . from ( base64Data , 'base64' ) ;
9595 res . writeHead ( 200 , {
96- 'Content-Type' : content_type ,
97- 'Content-Length' : file . length
96+ 'Content-Type' : content_type ,
97+ 'Content-Length' : file . length
9898 } ) ;
99- res . end ( file ) ;
100- }
101- else if ( content_type === 'text/html' ) {
99+ res . send ( file ) ;
100+ } else if ( content_type === 'text/html' ) {
102101 try {
103- let fullHtml = await render . HTML ( src , organization_id ) ;
104- res . type ( content_type ) ;
105- res . send ( fullHtml ) ;
102+ let html = await render . HTML ( src , organization_id ) ;
103+ if ( html )
104+ src = html
106105 }
107106 catch ( err ) {
108- if ( err . message . startsWith ( 'infinite loop:' ) ) {
109- console . log ( 'infinte loop' )
110- return res . send ( 'there is a infinite loop' ) ;
111-
112- }
113- else {
114- console . warn ( 'server-render: ' + err . message )
115- return res . send ( src + `<script>console.log("${ 'server-render: ' + err . message } ")</script>` )
116- }
107+ console . warn ( 'server-render: ' + err . message )
117108 }
118-
119- }
120- else {
109+ res . type ( content_type ) ;
110+ res . send ( src )
111+ } else {
121112 res . type ( content_type ) ;
122113 res . send ( src ) ;
123114 }
You can’t perform that action at this time.
0 commit comments