Commit 2a36adcd authored by jan.koester's avatar jan.koester
Browse files

test

parent ec4bcac2
Loading
Loading
Loading
Loading
+11 −4
Changes for editor/src/htmlimport.cpp: 11 added lines, 4 removed lines.
Original line number Diff line number Diff line
@@ -516,17 +516,24 @@ std::string blogi::htmlimport::rewriteCssUrls(
            std::string ref = (start == std::string::npos) ? ""
                             : inner.substr(start, end - start + 1);

            char quote = '\0';
            // Detect either quote style, but always re-emit with single
            // quotes regardless of which one the original used -- this text
            // can end up set as an HTML "style" attribute value (see
            // rewriteRelativeUrls), and libhtmlpp::HtmlElement::setAttribute
            // throws on ANY literal '"' in an attribute value (it has no
            // escaping, just an outright reject) -- so a double-quoted
            // url("...") re-emitted verbatim would crash the import outright.
            bool quoted = false;
            if (ref.size() >= 2 && (ref.front() == '"' || ref.front() == '\'') &&
                ref.back() == ref.front()) {
                quote = ref.front();
                quoted = true;
                ref = ref.substr(1, ref.size() - 2);
            }

            out += "url(";
            if (quote) out += quote;
            if (quoted) out += '\'';
            out += fn(ref);
            if (quote) out += quote;
            if (quoted) out += '\'';
            out += ')';
            i = close + 1;
        } else if (ciMatch(i, "@import")) {