exifreader 4.41.4 → 4.43.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/README.md +12 -1
- package/dist/exif-reader.js +1 -1
- package/dist/exif-reader.js.map +1 -1
- package/package.json +10 -10
- package/src/icc-tags.js +5 -2
- package/src/image-header-iso-bmff-iloc.js +31 -11
- package/src/image-header-iso-bmff.js +29 -17
- package/src/mpf-tags.js +12 -1
- package/src/photoshop-tags.js +10 -2
- package/src/png-tags.js +2 -2
- package/src/tags-helpers.js +59 -5
- package/src/tags.js +12 -7
- package/src/utils.js +1 -1
- package/src/xmp-namespaces.js +31 -12
- package/src/xmp-tags.js +12 -3
package/src/xmp-tags.js
CHANGED
|
@@ -179,8 +179,11 @@ function getTextValue(node) {
|
|
|
179
179
|
return node.nodeValue;
|
|
180
180
|
}
|
|
181
181
|
|
|
182
|
+
// The elements object must not have a prototype. The element names come from
|
|
183
|
+
// the image, so an element named e.g. constructor would be found among the
|
|
184
|
+
// inherited properties, and one named __proto__ would replace the prototype.
|
|
182
185
|
function getElementsFromNodes(nodes) {
|
|
183
|
-
const elements =
|
|
186
|
+
const elements = Object.create(null);
|
|
184
187
|
|
|
185
188
|
nodes.forEach((node) => {
|
|
186
189
|
if (isElement(node)) {
|
|
@@ -284,7 +287,7 @@ function getLocalName(name) {
|
|
|
284
287
|
function getDescription(value, name = undefined) {
|
|
285
288
|
if (Array.isArray(value)) {
|
|
286
289
|
const arrayDescription = getDescriptionOfArray(value);
|
|
287
|
-
if ((name)
|
|
290
|
+
if (hasTagNameFunction(name)) {
|
|
288
291
|
return XmpTagNames[name](value, arrayDescription);
|
|
289
292
|
}
|
|
290
293
|
return arrayDescription;
|
|
@@ -294,7 +297,7 @@ function getDescription(value, name = undefined) {
|
|
|
294
297
|
}
|
|
295
298
|
|
|
296
299
|
try {
|
|
297
|
-
if ((name)
|
|
300
|
+
if (hasTagNameFunction(name)) {
|
|
298
301
|
return XmpTagNames[name](value);
|
|
299
302
|
}
|
|
300
303
|
return decodeURIComponent(escape(value));
|
|
@@ -312,6 +315,12 @@ function getDescriptionOfArray(value) {
|
|
|
312
315
|
}).join(', ');
|
|
313
316
|
}
|
|
314
317
|
|
|
318
|
+
// The name comes from the image, so an inherited property of the tag name table
|
|
319
|
+
// must not be mistaken for a description function.
|
|
320
|
+
function hasTagNameFunction(name) {
|
|
321
|
+
return Object.prototype.hasOwnProperty.call(XmpTagNames, name) && (typeof XmpTagNames[name] === 'function');
|
|
322
|
+
}
|
|
323
|
+
|
|
315
324
|
function getDescriptionOfObject(value) {
|
|
316
325
|
const descriptions = [];
|
|
317
326
|
|