diff options
author | Nathan-SR <144961007+Nathan-SR@users.noreply.github.com> | 2024-07-19 02:23:54 -0400 |
---|---|---|
committer | Nathan-SR <144961007+Nathan-SR@users.noreply.github.com> | 2024-07-19 02:23:54 -0400 |
commit | b9e8290a2f9c75ae61edc3c89bd0fff5c9e3a0e5 (patch) | |
tree | 776dde05586da5d6dc768e8173b83c655aa2126f | |
parent | 56030ba4d7f1038095562ecd4c2937faebe80a30 (diff) |
img link bug
-rw-r--r-- | src/client/views/nodes/DataVizBox/DocCreatorMenu.tsx | 4 | ||||
-rw-r--r-- | src/server/server_Initialization.ts | 80 |
2 files changed, 47 insertions, 37 deletions
diff --git a/src/client/views/nodes/DataVizBox/DocCreatorMenu.tsx b/src/client/views/nodes/DataVizBox/DocCreatorMenu.tsx index cb10de65b..e48a6ada4 100644 --- a/src/client/views/nodes/DataVizBox/DocCreatorMenu.tsx +++ b/src/client/views/nodes/DataVizBox/DocCreatorMenu.tsx @@ -324,7 +324,7 @@ export class DocCreatorMenu extends ObservableReactComponent<{}> { <FontAwesomeIcon icon={'plus'}/> </button> {altLayout ? <button - className='docCreatorMenu-zoom-button zoom-in' + className='docCreatorMenu-zoom-button trash' onPointerDown={e => this.setUpButtonClick(e, () => runInAction(() => this._savedLayouts.splice(this._savedLayouts.indexOf(altLayout), 1)))}> <FontAwesomeIcon icon={'trash'}/> </button> : null} @@ -337,7 +337,7 @@ export class DocCreatorMenu extends ObservableReactComponent<{}> { gridTemplateRows: `${scaledDown(docHeight)}px`, gridAutoRows: `${scaledDown(docHeight)}px`, rowGap: `${scaledDown(layout.yMargin)}px`, - columnGap: `${scaledDown(layout.xMargin)}px` + columnGap: `${scaledDown(layout.xMargin)}px` }}> {this._layout.type === LayoutType.Stacked ? <div diff --git a/src/server/server_Initialization.ts b/src/server/server_Initialization.ts index 9183688c6..c3d31e74d 100644 --- a/src/server/server_Initialization.ts +++ b/src/server/server_Initialization.ts @@ -155,41 +155,51 @@ function proxyServe(req: any, requrl: string, response: any) { }; const retrieveHTTPBody = () => { // req.headers.cookie = ''; - req.pipe(request(requrl)) - .on('error', (e: any) => { - console.log(`CORS url error: ${requrl}`, e); - response.send(`<html><body bgcolor="red" link="006666" alink="8B4513" vlink="006666"> - <title>Error</title> - <div align="center"><h1>Failed to load: ${requrl} </h1></div> - <p>${e}</p> - </body></html>`); - }) - .on('response', (res: any) => { - res.headers; - const headers = Object.keys(res.headers); - const headerCharRegex = /[^\t\x20-\x7e\x80-\xff]/; - headers.forEach(headerName => { - const header = res.headers[headerName]; - if (Array.isArray(header)) { - res.headers[headerName] = header.filter(h => !headerCharRegex.test(h)); - } else if (headerCharRegex.test(header || '')) { - delete res.headers[headerName]; - } else res.headers[headerName] = header; - if (headerName === 'content-encoding') { - wasinBrFormat = res.headers[headerName] === 'br'; - res.headers[headerName] = 'gzip'; - } - }); - res.headers['x-permitted-cross-domain-policies'] = 'all'; - res.headers['x-frame-options'] = ''; - res.headers['content-security-policy'] = ''; - // eslint-disable-next-line no-multi-assign - response.headers = response._headers = res.headers; - }) - .on('end', sendModifiedBody) - .pipe(htmlBodyMemoryStream) - .on('error', (e: any) => console.log('http body pipe error', e)); - }; + try { + const reqval = request(requrl); + req.pipe(reqval) + .on('error', (e: any) => { + console.log(`CORS url error: ${requrl}`, e); + response.send(`<html><body bgcolor="red" link="006666" alink="8B4513" vlink="006666"> + <title>Error</title> + <div align="center"><h1>Failed to load: ${requrl} </h1></div> + <p>${e}</p> + </body></html>`); + }) + .on('response', (res: any) => { + res.headers; + const headers = Object.keys(res.headers); + const headerCharRegex = /[^\t\x20-\x7e\x80-\xff]/; + headers.forEach(headerName => { + const header = res.headers[headerName]; + if (Array.isArray(header)) { + res.headers[headerName] = header.filter(h => !headerCharRegex.test(h)); + } else if (headerCharRegex.test(header || '')) { + delete res.headers[headerName]; + } else res.headers[headerName] = header; + if (headerName === 'content-encoding') { + wasinBrFormat = res.headers[headerName] === 'br'; + res.headers[headerName] = 'gzip'; + } + }); + res.headers['x-permitted-cross-domain-policies'] = 'all'; + res.headers['x-frame-options'] = ''; + res.headers['content-security-policy'] = ''; + // eslint-disable-next-line no-multi-assign + response.headers = response._headers = res.headers; + }) + .on('end', sendModifiedBody) + .pipe(htmlBodyMemoryStream) + .on('error', (e: any) => console.log('http body pipe error', e)); + } catch (e) { + console.log("Request failed: ", e); + response.send(`<html><body bgcolor="red" link="006666" alink="8B4513" vlink="006666"> + <title>Error</title> + <div align="center"><h1>Failed to load: ${requrl} </h1></div> + <p>${e}</p> + </body></html>`); + } + } retrieveHTTPBody(); } |