Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix buggy image coercion so image names resolve correctly #8839

Merged
merged 2 commits into from
Oct 9, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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"]]
}
}
]
}