Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions dashboard/jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ const config = {

// Module name mapping for path aliases
moduleNameMapper: {
Comment thread
Brijesh619 marked this conversation as resolved.
'^sanitize-html$': '<rootDir>/src/__mocks__/sanitize-html.ts',
'^@/(.*)$': '<rootDir>/src/$1',
'^@components/(.*)$': '<rootDir>/src/components/$1',
'^@api/(.*)\.js$': '<rootDir>/src/api/$1.ts',
Expand Down
121 changes: 116 additions & 5 deletions dashboard/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dashboard/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@
"react-router-dom": "6.30.4",
"react-toastify": "10.0.5",
"recharts": "2.15.1",
"sanitize-html": "2.17.4"
"sanitize-html": "2.17.6"
},
"devDependencies": {
"@babel/preset-env": "7.28.5",
Expand Down
19 changes: 19 additions & 0 deletions dashboard/src/__mocks__/sanitize-html.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

const sanitizeHtml = (html: string) => typeof html === 'string' ? html.replace(/<script\b[^<]*(?:(?!<\/script>)<[^<]*)*<\/script>/gi, '') : html;
Comment thread
Brijesh619 marked this conversation as resolved.
Outdated
export default sanitizeHtml;
Loading