exiftool-vendored
Advanced tools
Comparing version 22.2.2 to 22.2.3
@@ -29,2 +29,6 @@ # Changelog/Versioning | ||
### v22.2.3 | ||
- 🐞 Apply the v22.2.3 bugfix _even wider_ (just found a `SubSecTime` value of "01" in the wild, and it was happily parsed into today's date, oops). | ||
### v22.2.2 | ||
@@ -31,0 +35,0 @@ |
@@ -8,2 +8,4 @@ "use strict"; | ||
const String_1 = require("./String"); | ||
const StrictExifRE = /^\d+:\d+:\d+|\d+-\d+-\d+$/; | ||
const LooseExifRE = /^\S+\s+\S+\s+\S+$/; | ||
/** | ||
@@ -20,3 +22,5 @@ * Encodes an ExifDate | ||
static fromISO(text) { | ||
return this.fromDateTime(luxon_1.DateTime.fromISO(text), text); | ||
return StrictExifRE.test((0, String_1.toS)(text).trim()) | ||
? this.fromDateTime(luxon_1.DateTime.fromISO(text), text) | ||
: undefined; | ||
} | ||
@@ -27,3 +31,9 @@ static fromPatterns(text, fmts) { | ||
text = (0, String_1.toS)(text).trim(); | ||
return (0, Maybe_1.first)(fmts, (fmt) => (0, Maybe_1.map)(luxon_1.DateTime.fromFormat(text, fmt), (dt) => this.fromDateTime(dt, text))); | ||
for (const fmt of fmts) { | ||
const dt = luxon_1.DateTime.fromFormat(text, fmt); | ||
if ((0, DateTime_1.validDateTime)(dt)) { | ||
return this.fromDateTime(dt, text); | ||
} | ||
} | ||
return; | ||
} | ||
@@ -35,6 +45,12 @@ // These are all formats I've seen in the wild from exiftool's output. | ||
static fromExifStrict(text) { | ||
return this.fromPatterns(text, ["y:MM:dd", "y-MM-dd", "y:M:d"]); | ||
return StrictExifRE.test((0, String_1.toS)(text).trim()) | ||
? this.fromPatterns(text, ["y:MM:dd", "y-MM-dd", "y:M:d"]) | ||
: undefined; | ||
} | ||
static fromExifLoose(text) { | ||
return this.fromPatterns(text, ["MMM d y", "MMMM d y"]); | ||
// Unfortunately, Luxon parses "00" and "01" as _today_. So if we don't | ||
// three non-blank strings parts, reject. | ||
return LooseExifRE.test((0, String_1.toS)(text).trim()) | ||
? this.fromPatterns(text, ["MMM d y", "MMMM d y"]) | ||
: undefined; | ||
} | ||
@@ -41,0 +57,0 @@ static fromEXIF(text) { |
@@ -5,3 +5,3 @@ "use strict"; | ||
const luxon_1 = require("luxon"); | ||
const Maybe_1 = require("./Maybe"); | ||
const DateTime_1 = require("./DateTime"); | ||
const String_1 = require("./String"); | ||
@@ -16,8 +16,18 @@ /** | ||
return; | ||
return (0, Maybe_1.first)(["HH:mm:ss.uZZ", "HH:mm:ssZZ", "HH:mm:ss.u", "HH:mm:ss"], (fmt) => (0, Maybe_1.map)(luxon_1.DateTime.fromFormat(text, fmt), (dt) => this.fromDateTime(dt, text))); | ||
for (const fmt of [ | ||
"HH:mm:ss.uZZ", | ||
"HH:mm:ssZZ", | ||
"HH:mm:ss.u", | ||
"HH:mm:ss", | ||
]) { | ||
const result = this.fromDateTime(luxon_1.DateTime.fromFormat(text, fmt), text); | ||
if (result != null) | ||
return result; | ||
} | ||
return; | ||
} | ||
static fromDateTime(dt, rawValue) { | ||
return dt == null || !dt.isValid | ||
? undefined | ||
: new ExifTime(dt.hour, dt.minute, dt.second, dt.millisecond, rawValue); | ||
return (0, DateTime_1.validDateTime)(dt) | ||
? new ExifTime(dt.hour, dt.minute, dt.second, dt.millisecond, rawValue) | ||
: undefined; | ||
} | ||
@@ -24,0 +34,0 @@ constructor(hour, minute, second, millisecond, rawValue) { |
@@ -208,3 +208,3 @@ /// <reference types="node" /> | ||
* This should only be applied as a last resort to images whose metadata is | ||
* not readable via {@link .read()}. | ||
* not readable via {@link ExifTool.read()}. | ||
* | ||
@@ -211,0 +211,0 @@ * @see https://exiftool.org/faq.html#Q20 |
@@ -316,3 +316,3 @@ "use strict"; | ||
* This should only be applied as a last resort to images whose metadata is | ||
* not readable via {@link .read()}. | ||
* not readable via {@link ExifTool.read()}. | ||
* | ||
@@ -319,0 +319,0 @@ * @see https://exiftool.org/faq.html#Q20 |
@@ -5,6 +5,6 @@ import { ExifToolTask } from "./ExifToolTask"; | ||
export declare const DefaultReadTaskOptions: { | ||
readonly includeImageDataMD5: boolean | undefined; | ||
readonly imageHashType: false | "MD5" | "SHA256" | "SHA512"; | ||
readonly useMWG: boolean; | ||
readonly numericTags: string[]; | ||
readonly imageHashType: false | "MD5" | "SHA256" | "SHA512"; | ||
readonly includeImageDataMD5: boolean | undefined; | ||
readonly defaultVideosToUTC: boolean; | ||
@@ -11,0 +11,0 @@ readonly backfillTimezones: boolean; |
{ | ||
"name": "exiftool-vendored", | ||
"version": "22.2.2", | ||
"version": "22.2.3", | ||
"description": "Efficient, cross-platform access to ExifTool", | ||
@@ -5,0 +5,0 @@ "main": "./dist/ExifTool.js", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
490050
8437