Skip to content

Commit 0adc633

Browse files
authored
Merge branch 'master' into sanitizeUrl-relative-paths
2 parents 3421432 + 0422415 commit 0adc633

File tree

3 files changed

+36
-3
lines changed

3 files changed

+36
-3
lines changed

Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
# We don't declare them here — take a look at our docs.
33
# https://github.com/swagger-api/swagger-ui/blob/master/docs/usage/configuration.md
44

5-
FROM nginx:1.29.1-alpine
5+
FROM nginx:1.29.2-alpine
66

77
LABEL maintainer="vladimir.gorej@gmail.com" \
88
org.opencontainers.image.authors="vladimir.gorej@gmail.com" \

src/core/components/property.jsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
11
import React from "react"
22
import PropTypes from "prop-types"
3+
import { stringify } from "core/utils"
34

45
export const Property = ({ propKey, propVal, propClass }) => {
56
return (
67
<span className={ propClass }>
7-
<br />{ propKey }: { String(propVal) }</span>
8+
<br />{ propKey }: { stringify(propVal) }</span>
89
)
910
}
1011
Property.propTypes = {

test/unit/core/utils.js

Lines changed: 33 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { Map, fromJS } from "immutable"
1+
import { Map, fromJS, OrderedMap } from "immutable"
22
import {
33
mapToList,
44
parseSearch,
@@ -23,6 +23,7 @@ import {
2323
requiresValidationURL,
2424
extractFileNameFromContentDispositionHeader,
2525
deeplyStripKey,
26+
stringify,
2627
paramToIdentifier,
2728
paramToValue,
2829
generateCodeVerifier,
@@ -1310,6 +1311,37 @@ describe("utils", () => {
13101311
})
13111312
})
13121313

1314+
describe("stringify", () => {
1315+
it("returns the string as-is", () => {
1316+
expect(stringify("hello")).toBe("hello")
1317+
})
1318+
1319+
it("converts Immutable objects to plain JS and stringifies", () => {
1320+
const immutableMap = OrderedMap({ key: "value" })
1321+
expect(stringify(immutableMap)).toBe('{\n "key": "value"\n}')
1322+
})
1323+
1324+
it("stringifies plain JS objects", () => {
1325+
const obj = { key: "value" }
1326+
expect(stringify(obj)).toBe('{\n "key": "value"\n}')
1327+
})
1328+
1329+
it("returns empty string for null or undefined", () => {
1330+
expect(stringify(null)).toBe("")
1331+
expect(stringify(undefined)).toBe("")
1332+
})
1333+
1334+
it("calls toString for numbers", () => {
1335+
expect(stringify(42)).toBe("42")
1336+
})
1337+
1338+
it("falls back to String() on JSON.stringify error", () => {
1339+
const circularObj = {}
1340+
circularObj.self = circularObj
1341+
expect(stringify(circularObj)).toBe("[object Object]")
1342+
})
1343+
})
1344+
13131345
describe("parse and serialize search", () => {
13141346
beforeEach(() => {
13151347
// jsdom in Jest 25+ prevents modifying window.location,

0 commit comments

Comments
 (0)