Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Fix parsing of identify

Histogram output of identify has started to align on ':' which causes
parseIdentify to fail for this section.
  • Loading branch information...
commit 20ba7144327a836f47799634dc7279c066b39fc7 1 parent b830fe9
@mcfedr authored
Showing with 9 additions and 7 deletions.
  1. +9 −7 imagemagick.js
View
16 imagemagick.js
@@ -104,7 +104,7 @@ function parseIdentify(input) {
props = [prop],
prevIndent = 0,
indents = [indent],
- currentLine, comps, indent, i;
+ currentLine, comps, indent, i, propName;
lines.shift(); //drop first line (Image: name.jpg)
@@ -113,15 +113,17 @@ function parseIdentify(input) {
indent = currentLine.search(/\S/);
if (indent >= 0) {
comps = currentLine.split(': ');
- if (indent > prevIndent) indents.push(indent);
- while (indent < prevIndent && props.length) {
- indents.pop();
- prop = props.pop();
- prevIndent = indents[indents.length - 1];
+ if(propName != 'histogram') {
+ if (indent > prevIndent) indents.push(indent);
+ while (indent < prevIndent && props.length) {
+ indents.pop();
+ prop = props.pop();
+ prevIndent = indents[indents.length - 1];
+ }
}
if (comps.length < 2) {
props.push(prop);
- prop = prop[currentLine.split(':')[0].trim().toLowerCase()] = {};
+ prop = prop[propName = currentLine.split(':')[0].trim().toLowerCase()] = {};
} else {
prop[comps[0].trim().toLowerCase()] = comps[1].trim()
}
Please sign in to comment.
Something went wrong with that request. Please try again.