@ntlab/sipd-tu-bridge-ui 1.7.1 → 1.7.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ntlab/sipd-tu-bridge-ui",
3
- "version": "1.7.1",
3
+ "version": "1.7.3",
4
4
  "description": "SIPD Penatausahaan Bridge Web Interface",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -127,7 +127,9 @@ $.error.handle = function(el) {
127
127
  if (el.attr('href') !== '#') {
128
128
  $.get(el.attr('href'))
129
129
  .done(function(data) {
130
- $('#err-view-dlg .container').html(typeof data === 'object' ? JSON.stringify(data, null, 2) : $.safeStr(data));
130
+ $.fixBuffer(data);
131
+ const content = typeof data === 'object' ? JSON.stringify(data, null, 2) : $.safeStr(data);
132
+ $('#err-view-dlg .container').html(\`<pre>\${content}</pre>\`);
131
133
  });
132
134
  }
133
135
  }
package/views/ui/util.ejs CHANGED
@@ -72,7 +72,7 @@ $.hidePayload = function(message) {
72
72
  return message;
73
73
  }
74
74
  $.isPayload = function(data) {
75
- return Array.isArray(data) || typeof data === 'object' && data.constructor.name === 'Object';
75
+ return Array.isArray(data) || $.isPlainObject(data);
76
76
  }
77
77
  $.safeStr = function(s) {
78
78
  if (s !== '') {
@@ -91,4 +91,17 @@ $.toStr = function(o) {
91
91
  }
92
92
  return '';
93
93
  }
94
+ $.fixBuffer = function(data) {
95
+ if ($.isPlainObject(data)) {
96
+ for (const key of Object.keys(data)) {
97
+ if (data[key]) {
98
+ if (data[key].type === 'Buffer' && Array.isArray(data[key].data)) {
99
+ data[key] = data[key].data;
100
+ } else {
101
+ $.fixBuffer(data[key]);
102
+ }
103
+ }
104
+ }
105
+ }
106
+ }
94
107
  `) -%>