Loading editor/src/webedit_api.cpp +16 −2 Original line number Diff line number Diff line Loading @@ -818,11 +818,25 @@ void webedit::Api::handlePreviewPage(libhttppp::HttpRequest &curreq, return; } // The blog returns a complete themed HTML page — forward it directly // Inject <base href> so relative paths (CSS, images, JS) resolve // against the blog server, not the editor server. std::string page(respData.begin(), respData.end()); std::string baseTag = "<base href=\"" + blogUrl + "/\">"; auto headPos = page.find("<head>"); if (headPos == std::string::npos) headPos = page.find("<head "); if (headPos != std::string::npos) { auto insertPos = page.find('>', headPos) + 1; page.insert(insertPos, baseTag); } else { // No <head> found — prepend base tag page = baseTag + page; } libhttppp::HttpResponse curres; curres.setState(HTTP200); curres.setContentType("text/html"); curres.send(curreq, respData.data(), respData.size()); curres.send(curreq, page.data(), page.size()); } catch (const std::exception &e) { std::string errPage = "<!DOCTYPE html><html><body><p>Preview error: " + Loading Loading
editor/src/webedit_api.cpp +16 −2 Original line number Diff line number Diff line Loading @@ -818,11 +818,25 @@ void webedit::Api::handlePreviewPage(libhttppp::HttpRequest &curreq, return; } // The blog returns a complete themed HTML page — forward it directly // Inject <base href> so relative paths (CSS, images, JS) resolve // against the blog server, not the editor server. std::string page(respData.begin(), respData.end()); std::string baseTag = "<base href=\"" + blogUrl + "/\">"; auto headPos = page.find("<head>"); if (headPos == std::string::npos) headPos = page.find("<head "); if (headPos != std::string::npos) { auto insertPos = page.find('>', headPos) + 1; page.insert(insertPos, baseTag); } else { // No <head> found — prepend base tag page = baseTag + page; } libhttppp::HttpResponse curres; curres.setState(HTTP200); curres.setContentType("text/html"); curres.send(curreq, respData.data(), respData.size()); curres.send(curreq, page.data(), page.size()); } catch (const std::exception &e) { std::string errPage = "<!DOCTYPE html><html><body><p>Preview error: " + Loading