Handle http://ns.adobe.com/xmp/extension/ in ExifUtil
authorTim Düsterhus <duesterhus@woltlab.com>
Tue, 20 Oct 2020 08:56:33 +0000 (10:56 +0200)
committerTim Düsterhus <duesterhus@woltlab.com>
Tue, 20 Oct 2020 08:56:33 +0000 (10:56 +0200)
Resolves #3616

wcfsetup/install/files/js/WoltLabSuite/Core/Image/ExifUtil.js

index cc6f5a01624d9ee1bfcb042e54f45cae0d1e2c3f..c4846ec452c4893d9c7e9901904b759ce8bf87f9 100644 (file)
@@ -32,6 +32,11 @@ define([], function() {
        // Known sequence signatures
        var _signatureEXIF = 'Exif';
        var _signatureXMP  = 'http://ns.adobe.com/xap/1.0/';
+       var _signatureXMPExtension = 'http://ns.adobe.com/xmp/extension/';
+       
+       function isExifSignature(signature) {
+               return signature === _signatureEXIF || signature === _signatureXMP || signature === _signatureXMPExtension;
+       }
        
        return {
                /**
@@ -76,7 +81,7 @@ define([], function() {
                                                        }
                                                        
                                                        // Only copy Exif and XMP data
-                                                       if (signature === _signatureEXIF || signature === _signatureXMP) {
+                                                       if (isExifSignature(signature)) {
                                                                // append the found EXIF sequence, usually only a single EXIF (APP1) sequence should be defined
                                                                var sequence = Array.prototype.slice.call(bytes, i, length + i); // IE11 does not have slice in the Uint8Array prototype
                                                                var concat = new Uint8Array(exif.length + sequence.length);
@@ -137,8 +142,8 @@ define([], function() {
                                                                signature += String.fromCharCode(bytes[j]);
                                                        }
                                                        
-                                                       // Only remove Exif and XMP data
-                                                       if (signature === _signatureEXIF || signature === _signatureXMP) {
+                                                       // Only remove known signatures
+                                                       if (isExifSignature(signature)) {
                                                                var start = Array.prototype.slice.call(bytes, 0, i);
                                                                var end = Array.prototype.slice.call(bytes, i + length);
                                                                bytes = new Uint8Array(start.length + end.length);