@ubercode/dcmtk 0.15.0 → 0.16.0
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/dist/dicom.cjs +10 -4
- package/dist/dicom.cjs.map +1 -1
- package/dist/dicom.js +10 -4
- package/dist/dicom.js.map +1 -1
- package/dist/{index-D7nnTY1R.d.ts → index-C6dWOhHS.d.ts} +32 -1
- package/dist/{index-CtqMUrjP.d.cts → index-D1msvaAt.d.cts} +32 -1
- package/dist/index.cjs +148 -11
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +148 -11
- package/dist/index.js.map +1 -1
- package/dist/servers.cjs +142 -10
- package/dist/servers.cjs.map +1 -1
- package/dist/servers.d.cts +1 -1
- package/dist/servers.d.ts +1 -1
- package/dist/servers.js +142 -10
- package/dist/servers.js.map +1 -1
- package/dist/tools.cjs +10 -4
- package/dist/tools.cjs.map +1 -1
- package/dist/tools.js +10 -4
- package/dist/tools.js.map +1 -1
- package/package.json +1 -1
package/dist/tools.js
CHANGED
|
@@ -360,8 +360,14 @@ var KNOWN_VR_CODES = /* @__PURE__ */ new Set([
|
|
|
360
360
|
"UT",
|
|
361
361
|
"UV"
|
|
362
362
|
]);
|
|
363
|
+
function decodeXmlEntities(value) {
|
|
364
|
+
return value.replace(/</g, "<").replace(/>/g, ">").replace(/"/g, '"').replace(/'/g, "'").replace(/&/g, "&");
|
|
365
|
+
}
|
|
366
|
+
function decodeIfString(value) {
|
|
367
|
+
return typeof value === "string" ? decodeXmlEntities(value) : value;
|
|
368
|
+
}
|
|
363
369
|
function buildPnString(comp) {
|
|
364
|
-
const parts = [comp.FamilyName ?? "", comp.GivenName ?? "", comp.MiddleName ?? "", comp.NamePrefix ?? "", comp.NameSuffix ?? ""];
|
|
370
|
+
const parts = [comp.FamilyName ?? "", comp.GivenName ?? "", comp.MiddleName ?? "", comp.NamePrefix ?? "", comp.NameSuffix ?? ""].map(decodeXmlEntities);
|
|
365
371
|
let last = parts.length - 1;
|
|
366
372
|
for (; last >= 0; last--) {
|
|
367
373
|
if (parts[last] !== "") break;
|
|
@@ -400,9 +406,9 @@ function convertBulkDataURI(attr, element) {
|
|
|
400
406
|
const bulkArray = toArray(attr.BulkDataURI);
|
|
401
407
|
const firstBulk = bulkArray[0];
|
|
402
408
|
if (typeof firstBulk === "object" && firstBulk !== null && "@_uri" in firstBulk) {
|
|
403
|
-
element.BulkDataURI = safeString(firstBulk["@_uri"]);
|
|
409
|
+
element.BulkDataURI = decodeXmlEntities(safeString(firstBulk["@_uri"]));
|
|
404
410
|
} else {
|
|
405
|
-
element.BulkDataURI = safeString(firstBulk);
|
|
411
|
+
element.BulkDataURI = decodeXmlEntities(safeString(firstBulk));
|
|
406
412
|
}
|
|
407
413
|
}
|
|
408
414
|
function convertPNValue(attr, element) {
|
|
@@ -446,7 +452,7 @@ function convertRegularValue(attr, element, vr) {
|
|
|
446
452
|
const values = [];
|
|
447
453
|
const isNumeric = NUMERIC_JSON_VRS.has(vr);
|
|
448
454
|
for (const v of valArray) {
|
|
449
|
-
const unwrapped = unwrapValue(v);
|
|
455
|
+
const unwrapped = decodeIfString(unwrapValue(v));
|
|
450
456
|
values.push(isNumeric ? coerceNumeric(unwrapped) : unwrapped);
|
|
451
457
|
}
|
|
452
458
|
if (values.length > 0) element.Value = values;
|