rusackas commented on code in PR #37625:
URL: https://github.com/apache/superset/pull/37625#discussion_r2760136605
##########
superset-frontend/plugins/legacy-plugin-chart-country-map/src/CountryMap.ts:
##########
@@ -213,8 +234,16 @@ function CountryMap(element, props) {
if (map) {
drawMap(map);
} else {
- const url = countries[country];
- d3.json(url, (error, mapData) => {
+ const url = (countries as Record<string, string>)[country];
+ if (!url) {
+ const countryName =
+ countryOptions.find(x => x[0] === country)?.[1] || country;
+ d3.select(element).html(
+ `<div class="alert alert-danger">No map data available for
${countryName}</div>`,
+ );
Review Comment:
This is pre-existing code that was migrated as-is. The country parameter
comes from chart configuration, not user input. However, the XSS concern is
valid and should be addressed in a security-focused follow-up PR.
##########
superset-frontend/plugins/legacy-plugin-chart-horizon/src/transformProps.ts:
##########
@@ -16,15 +16,20 @@
* specific language governing permissions and limitations
* under the License.
*/
-export default function transformProps(chartProps) {
+import { ChartProps } from '@superset-ui/core';
+
+export default function transformProps(chartProps: ChartProps) {
const { height, width, formData, queriesData } = chartProps;
- const { horizonColorScale, seriesHeight } = formData;
+ const {
+ horizon_color_scale: horizonColorScale,
+ series_height: seriesHeight,
+ } = formData;
return {
- colorScale: horizonColorScale,
+ colorScale: horizonColorScale as string | undefined,
Review Comment:
This is a direct TypeScript migration of existing legacy plugin code. The
suggestion identifies a pre-existing edge case that should be addressed in a
separate bug fix PR, not in a migration PR.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]