Skip to content

Commit

Permalink
Fix buggy image coercion so image names resolve correctly (#8839)
Browse files Browse the repository at this point in the history
  • Loading branch information
Ryan Hamley authored Oct 9, 2019
1 parent 5001f1e commit 1c7f3f9
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/style-spec/expression/definitions/coercion.js
Original file line number Diff line number Diff line change
Expand Up @@ -102,8 +102,8 @@ class Coercion implements Expression {
// created by properties that expect the 'formatted' type.
return Formatted.fromString(valueToString(this.args[0].evaluate(ctx)));
} else if (this.type.kind === 'image') {
const name = valueToString(this.args[0].evaluate(ctx));
return ResolvedImage.fromString({name, available: false});
const name = this.args[0].evaluate(ctx);
return typeof name === 'string' ? ResolvedImage.fromString({name, available: false}) : name;
} else {
return valueToString(this.args[0].evaluate(ctx));
}
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
{
"version": 8,
"metadata": {
"test": {
"height": 64,
"width": 64
}
},
"sources": {
"geojson": {
"type": "geojson",
"data": {
"type": "Point",
"coordinates": [
0,
0
]
}
}
},
"sprite": "local://sprites/sprite",
"layers": [
{
"id": "text",
"type": "symbol",
"source": "geojson",
"layout": {
"icon-image": ["coalesce", ["image", "dot.sdf"], ["image", "foo"]]
}
}
]
}

0 comments on commit 1c7f3f9

Please sign in to comment.