Skip to content

Commit f7e5495

Browse files
check PR 4025
1 parent 5090499 commit f7e5495

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

redisinsight/ui/src/utils/formatters/valueFormatters.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ const formattingBuffer = (
9696
}
9797
case KeyValueFormat.PHP: {
9898
try {
99-
const decoded = unserialize(Buffer.from(reply.data), {}, { strict: false, encoding: 'binary' })
99+
const decoded = unserialize(bufferToUTF8(reply), {}, { strict: false, encoding: 'utf8' })
100100
const value = JSONBigInt.stringify(decoded)
101101
return JSONViewer({ value, ...props })
102102
} catch (e) {
@@ -216,7 +216,7 @@ const bufferToSerializedFormat = (
216216
}
217217
case KeyValueFormat.PHP: {
218218
try {
219-
const decoded = unserialize(Buffer.from(value.data), {}, { strict: false, encoding: 'binary' })
219+
const decoded = unserialize(bufferToUTF8(value), {}, { strict: false, encoding: 'utf8' })
220220
const stringified = JSON.stringify(decoded)
221221
return reSerializeJSON(stringified, space)
222222
} catch (e) {

redisinsight/ui/src/utils/tests/formatters/valueFormatters.spec.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ describe('bufferToSerializedFormat', () => {
9494

9595
describe(KeyValueFormat.PHP, () => {
9696
describe('should properly serialize', () => {
97-
const testValues = [[1], '""', 6677, true, { a: { b: [1, 2, '3'] } }].map((v) => ({
97+
const testValues = [[1], '""', '反序列化', 6677, true, { a: { b: [1, 2, '3'] } }].map((v) => ({
9898
input: stringToBuffer(serialize(v)),
9999
expected: JSON.stringify(v)
100100
}))
@@ -156,7 +156,7 @@ describe('stringToSerializedBufferFormat', () => {
156156

157157
describe(KeyValueFormat.PHP, () => {
158158
describe('should properly unserialize', () => {
159-
const testValues = [[1], '""', 6677, true, { a: { b: [1, 2, '3'] } }].map((v) => ({
159+
const testValues = [[1], '""', '反序列化', 6677, true, { a: { b: [1, 2, '3'] } }].map((v) => ({
160160
input: JSON.stringify(v),
161161
expected: stringToBuffer(serialize(v))
162162
}))

0 commit comments

Comments
 (0)