src/agent/Core/SpawningKit/ErrorRenderer.h in passenger-5.3.1 vs src/agent/Core/SpawningKit/ErrorRenderer.h in passenger-5.3.2

- old
+ new

@@ -1,8 +1,8 @@ /* * Phusion Passenger - https://www.phusionpassenger.com/ - * Copyright (c) 2014-2017 Phusion Holding B.V. + * Copyright (c) 2014-2018 Phusion Holding B.V. * * "Passenger", "Phusion Passenger" and "Union Station" are registered * trademarks of Phusion Holding B.V. * * Permission is hereby granted, free of charge, to any person obtaining a copy @@ -32,12 +32,12 @@ #include <jsoncpp/json.h> #include <Constants.h> #include <StaticString.h> +#include <FileTools/FileManip.h> #include <Utils/Template.h> -#include <Utils/IOUtils.h> #include <Core/SpawningKit/Context.h> #include <Core/SpawningKit/Exceptions.h> namespace Passenger { namespace SpawningKit { @@ -59,12 +59,12 @@ string renderWithDetails(const SpawningKit::SpawnException &e) const { StringMap<StaticString> params; string htmlFile = templatesDir + "/with_details/src/index.html.template"; string cssFile = templatesDir + "/with_details/dist/styles.css"; string jsFile = templatesDir + "/with_details/dist/bundle.js"; - string cssContent = readAll(cssFile); - string jsContent = readAll(jsFile); + string cssContent = unsafeReadFile(cssFile); + string jsContent = unsafeReadFile(jsFile); Json::Value spec; spec["program_name"] = PROGRAM_NAME; spec["short_program_name"] = SHORT_PROGRAM_NAME; spec["config"] = e.getConfig().getNonConfidentialFieldsToPassToApp(); @@ -83,20 +83,20 @@ params.set("CSS", cssContent); params.set("JS", jsContent); params.set("TITLE", "Web application could not be started"); params.set("SPEC", specContent); - return Template::apply(readAll(htmlFile), params); + return Template::apply(unsafeReadFile(htmlFile), params); } string renderWithoutDetails(const SpawningKit::SpawnException &e) const { StringMap<StaticString> params; string htmlFile = templatesDir + "/without_details/src/index.html.template"; string cssFile = templatesDir + "/without_details/dist/styles.css"; string jsFile = templatesDir + "/without_details/dist/bundle.js"; - string cssContent = readAll(cssFile); - string jsContent = readAll(jsFile); + string cssContent = unsafeReadFile(cssFile); + string jsContent = unsafeReadFile(jsFile); params.set("CSS", cssContent); params.set("JS", jsContent); params.set("TITLE", "Web application could not be started"); params.set("SUMMARY", e.getSummary()); @@ -104,10 +104,10 @@ params.set("PROGRAM_NAME", PROGRAM_NAME); params.set("SHORT_PROGRAM_NAME", SHORT_PROGRAM_NAME); params.set("PROGRAM_WEBSITE", PROGRAM_WEBSITE); params.set("PROGRAM_AUTHOR", PROGRAM_AUTHOR); - return Template::apply(readAll(htmlFile), params); + return Template::apply(unsafeReadFile(htmlFile), params); } }; } // namespace SpawningKit