diff --git a/services/web/app/src/Features/ServerAdmin/AdminController.mjs b/services/web/app/src/Features/ServerAdmin/AdminController.mjs index a5aae424ad..4916292454 100644 --- a/services/web/app/src/Features/ServerAdmin/AdminController.mjs +++ b/services/web/app/src/Features/ServerAdmin/AdminController.mjs @@ -69,15 +69,15 @@ const AdminController = { let url const openSockets = {} for (url in http.globalAgent.sockets) { - openSockets[`http://${url}`] = http.globalAgent.sockets[url].map( - socket => socket._httpMessage.path - ) + openSockets[`http://${url}`] = http.globalAgent.sockets[url].map(socket => { + return socket._httpMessage?.path || '(unknown request)' + }) } for (url in https.globalAgent.sockets) { - openSockets[`https://${url}`] = https.globalAgent.sockets[url].map( - socket => socket._httpMessage.path - ) + openSockets[`https://${url}`] = https.globalAgent.sockets[url].map(socket => { + return socket._httpMessage?.path || '(unknown request)' + }) } const systemMessages = diff --git a/services/web/frontend/js/shared/components/footer/thin-footer.tsx b/services/web/frontend/js/shared/components/footer/thin-footer.tsx index 765e7573aa..aa1ba6c559 100644 --- a/services/web/frontend/js/shared/components/footer/thin-footer.tsx +++ b/services/web/frontend/js/shared/components/footer/thin-footer.tsx @@ -16,9 +16,14 @@ function FooterItemLi({ label, }: FooterItem) { const textToDisplay = translatedText || text + const hasMarkup = /<[^>]+>/.test(textToDisplay) if (!href) { - return
  • + return hasMarkup ? ( +
  • + ) : ( +
  • {textToDisplay}
  • + ) } const linkProps = { @@ -29,7 +34,11 @@ function FooterItemLi({ return (
  • - {textToDisplay} + {hasMarkup ? ( + + ) : ( + {textToDisplay} + )}
  • ) } diff --git a/services/web/test/frontend/shared/components/footer.test.tsx b/services/web/test/frontend/shared/components/footer.test.tsx new file mode 100644 index 0000000000..cca6631461 --- /dev/null +++ b/services/web/test/frontend/shared/components/footer.test.tsx @@ -0,0 +1,37 @@ +import React from 'react' +import ThinFooter from '../../../../frontend/js/shared/components/footer/thin-footer' + +describe('', function () { + it('renders raw HTML image tags in footer items without a URL', function () { + cy.mount( + ' }]} + rightItems={[]} + /> + ) + + cy.get('footer.site-footer img[alt="Logo"]').should('exist') + }) + + it('renders raw HTML inside a footer link when URL is provided', function () { + cy.mount( + ', + url: '/foo', + }, + ]} + rightItems={[]} + /> + ) + + cy.get('footer.site-footer a[href="/foo"] img[alt="Logo"]').should('exist') + }) +})