Skip to content

Commit

Permalink
fixed parsing jsonConfig
Browse files Browse the repository at this point in the history
- closes #2129
  • Loading branch information
foxriver76 committed Sep 25, 2023
1 parent 6f8f23f commit 36809c6
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,9 @@ The icons may not be reused in other projects without the proper flaticon licens
### **WORK IN PROGRESS**
-->
## Changelog
### **WORK IN PROGRESS**
* (foxriver76) fixed parsing jsonConfig

### 6.10.3 (2023-09-25)
* (foxriver76) fixed `installedFrom` other source indicator not shown on adapters tab
* (foxriver76) allow to use enter key to save changes in object edit dialog
Expand Down
6 changes: 5 additions & 1 deletion src/src/components/JsonConfig.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -415,7 +415,9 @@ class JsonConfig extends Router<JsonConfigProps, JsonConfigState> {
file = data.file;
}

if (typeof file !== 'string' && file.type === 'Buffer') {
if (typeof file === 'string') {
content = file;
} else if (file.type === 'Buffer') {
let binary = '';
const bytes = new Uint8Array(file.data);
const len = bytes.byteLength;
Expand All @@ -431,6 +433,8 @@ class JsonConfig extends Router<JsonConfigProps, JsonConfigState> {
this.props.socket.subscribeFiles(`${this.props.adapterName}.admin`, this.fileSubscribed, this.onFileChange);
}

console.log(content);

try {
return JSON5.parse(content);
} catch (e) {
Expand Down

0 comments on commit 36809c6

Please sign in to comment.