exiftool-vendored
Advanced tools
Comparing version 16.3.0 to 16.4.0
@@ -28,2 +28,16 @@ # Changelog/Versioning | ||
### v16.4.0 | ||
- 🐞 Struct values are now properly encoded when writing. Specifically, prior | ||
versions didn't support JSON string values (and now WriteTask knows how to | ||
serialize those characters to make ExifTool happy) | ||
- 📦/💔 `String.htmlEncode` was made private: it was a special-purpose function | ||
just for `WriteTask`. | ||
- 📦 Added Node 18 to test matrix. Node 12 will be dropped from support in the | ||
next version. | ||
- 📦 Updated dependencies | ||
### v16.3.0 | ||
@@ -30,0 +44,0 @@ |
@@ -86,2 +86,3 @@ "use strict"; | ||
args.push("-all", "-charset", "filename=utf8", sourceFile); | ||
// console.log("new ReadTask()", { sourceFile, args }) | ||
return new ReadTask(sourceFile, args); | ||
@@ -88,0 +89,0 @@ } |
@@ -14,2 +14,1 @@ import { Maybe } from "./Maybe"; | ||
export declare function stripSuffix(s: string, suffix: string): string; | ||
export declare function htmlEncode(s: string): string; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.htmlEncode = exports.stripSuffix = exports.stripPrefix = exports.pad3 = exports.pad2 = exports.leftPad = exports.toS = exports.notBlank = exports.blank = exports.isString = void 0; | ||
const he_1 = require("he"); | ||
exports.stripSuffix = exports.stripPrefix = exports.pad3 = exports.pad2 = exports.leftPad = exports.toS = exports.notBlank = exports.blank = exports.isString = void 0; | ||
const Array_1 = require("./Array"); | ||
@@ -66,9 +65,2 @@ function isString(o) { | ||
exports.stripSuffix = stripSuffix; | ||
function htmlEncode(s) { | ||
// `he` doesn't encode whitespaces (like newlines), but we need that: | ||
return (0, he_1.encode)(s, { decimal: true }).replace(/\s/g, (m) => | ||
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion | ||
m[0] === " " ? " " : `&#${m[0].charCodeAt(0)};`); | ||
} | ||
exports.htmlEncode = htmlEncode; | ||
//# sourceMappingURL=String.js.map |
import { WriteTags } from "./ExifTool"; | ||
import { ExifToolTask } from "./ExifToolTask"; | ||
export declare function htmlEncode(s: string): string; | ||
export declare class WriteTask extends ExifToolTask<void> { | ||
@@ -4,0 +5,0 @@ readonly sourceFile: string; |
@@ -26,3 +26,4 @@ "use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.WriteTask = void 0; | ||
exports.WriteTask = exports.htmlEncode = void 0; | ||
const he_1 = require("he"); | ||
const _path = __importStar(require("path")); | ||
@@ -51,3 +52,13 @@ const Array_1 = require("./Array"); | ||
]; | ||
function enc(o) { | ||
// this is private because it's very special-purpose for just encoding ExifTool | ||
// WriteTask args: | ||
function htmlEncode(s) { | ||
return ( | ||
// allowUnsafeSymbols is true because ExifTool doesn't care about &, <, >, ", ', * and ` | ||
(0, he_1.encode)(s, { decimal: true, allowUnsafeSymbols: true }) | ||
// `he` doesn't encode whitespaces (like newlines), but we need that: | ||
.replace(/\s/g, (m) => (m === " " ? " " : `&#${m.charCodeAt(0)};`))); | ||
} | ||
exports.htmlEncode = htmlEncode; | ||
function enc(o, structValue = false) { | ||
if (o == null) { | ||
@@ -60,3 +71,6 @@ return ""; | ||
else if ((0, String_1.isString)(o)) { | ||
return (0, String_1.htmlEncode)(String(o)); | ||
// Structs need their own escaping here. | ||
// See https://exiftool.org/struct.html#Serialize | ||
return htmlEncode(structValue ? o.replace(/[,[\]{}|]/g, (ea) => "|" + ea) : o); | ||
// const s = htmlEncode(String(o)) | ||
} | ||
@@ -69,4 +83,4 @@ else if ((0, DateTime_1.isDateOrTime)(o)) { | ||
return primitiveArray | ||
? `${o.map(enc).join(sep)}` | ||
: `[${o.map(enc).join(",")}]`; | ||
? `${o.map((ea) => enc(ea)).join(sep)}` | ||
: `[${o.map((ea) => enc(ea)).join(",")}]`; | ||
} | ||
@@ -76,3 +90,3 @@ else if ((0, Struct_1.isStruct)(o)) { | ||
return `{${(0, Object_1.keys)(o) | ||
.map((k) => enc(k) + " = " + enc(o[k])) | ||
.map((k) => enc(k, true) + "=" + enc(o[k], true)) | ||
.join(",")}}`; | ||
@@ -79,0 +93,0 @@ } |
{ | ||
"name": "exiftool-vendored", | ||
"version": "16.3.0", | ||
"version": "16.4.0", | ||
"description": "Efficient, cross-platform access to ExifTool", | ||
@@ -89,3 +89,3 @@ "main": "./dist/ExifTool.js", | ||
"@types/mocha": "^9.1.0", | ||
"@types/node": "^17.0.24", | ||
"@types/node": "^17.0.25", | ||
"@types/progress": "^2.0.5", | ||
@@ -96,4 +96,4 @@ "@types/rimraf": "^3.0.2", | ||
"@types/xmldom": "^0.1.31", | ||
"@typescript-eslint/eslint-plugin": "^5.19.0", | ||
"@typescript-eslint/parser": "^5.19.0", | ||
"@typescript-eslint/eslint-plugin": "^5.20.0", | ||
"@typescript-eslint/parser": "^5.20.0", | ||
"chai": "^4.3.6", | ||
@@ -106,3 +106,3 @@ "chai-as-promised": "^7.1.1", | ||
"extract-zip": "^2.0.1", | ||
"fs-extra": "^10.0.1", | ||
"fs-extra": "^10.1.0", | ||
"globule": "^1.3.3", | ||
@@ -127,3 +127,3 @@ "mocha": "^9.2.2", | ||
"he": "^1.2.0", | ||
"luxon": "^2.3.1", | ||
"luxon": "^2.3.2", | ||
"tz-lookup": "^6.1.25" | ||
@@ -130,0 +130,0 @@ }, |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
411928
7323
Updatedluxon@^2.3.2