svg_loader: <image> tag introduced fix #6

Moved file:// removing into _imageBuildHelper
This commit is contained in:
Michal Maciola 2021-07-02 13:05:10 +02:00 committed by Hermet Park
parent 3e4512a9a6
commit 1f67c1d689
2 changed files with 1 additions and 1 deletions

View file

@ -1534,7 +1534,6 @@ static string* _idFromHref(const char* href)
{ {
href = _skipSpace(href, nullptr); href = _skipSpace(href, nullptr);
if ((*href) == '#') href++; if ((*href) == '#') href++;
if(!strncmp(href, "file://", sizeof("file://") - 1)) href += sizeof("file://") - 1;
return new string(href); return new string(href);
} }

View file

@ -432,6 +432,7 @@ static unique_ptr<Picture> _imageBuildHelper(SvgNode* node, float vx, float vy,
} }
} else { } else {
if(!strncmp(href, "file://", sizeof("file://") - 1)) href += sizeof("file://") - 1;
//TODO: protect against recursive svg image loading //TODO: protect against recursive svg image loading
if (picture->load(href) != Result::Success) return nullptr; if (picture->load(href) != Result::Success) return nullptr;
picture->size(node->node.image.w, node->node.image.h); picture->size(node->node.image.w, node->node.image.h);