[core] add check for missing sprite URL file extension

This commit is contained in:
Konstantin Käfer
2016-07-19 16:01:24 +02:00
parent 1bc4f0e027
commit 559f3a654b
2 changed files with 14 additions and 0 deletions

View File

@@ -83,10 +83,18 @@ std::string normalizeSpriteURL(const std::string& url, const std::string& access
std::string id, extension;
if (isDraft) {
size_t index = pathname[3].find_first_of("@.");
if (index == std::string::npos) {
Log::Error(Event::ParseStyle, "Invalid sprite URL");
return url;
}
id = pathname[2];
extension = pathname[3].substr(index);
} else {
size_t index = pathname[2].find_first_of("@.");
if (index == std::string::npos) {
Log::Error(Event::ParseStyle, "Invalid sprite URL");
return url;
}
id = pathname[2].substr(0, index);
extension = pathname[2].substr(index);
}