File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -874,6 +874,11 @@ namespace confighttp {
874874 print_req (request);
875875
876876 std::ifstream in (WEB_DIR " images/sunshine.ico" , std::ios::binary);
877+ if (!in.is_open ()) {
878+ response->write (SimpleWeb::StatusCode::client_error_not_found);
879+ response->close_connection_after_response = true ;
880+ return ;
881+ }
877882 SimpleWeb::CaseInsensitiveMultimap headers;
878883 headers.emplace (" Content-Type" , " image/x-icon" );
879884 headers.emplace (" X-Frame-Options" , " DENY" );
@@ -892,6 +897,11 @@ namespace confighttp {
892897 print_req (request);
893898
894899 std::ifstream in (WEB_DIR " images/logo-sunshine-45.png" , std::ios::binary);
900+ if (!in.is_open ()) {
901+ response->write (SimpleWeb::StatusCode::client_error_not_found);
902+ response->close_connection_after_response = true ;
903+ return ;
904+ }
895905 SimpleWeb::CaseInsensitiveMultimap headers;
896906 headers.emplace (" Content-Type" , " image/png" );
897907 headers.emplace (" X-Frame-Options" , " DENY" );
Original file line number Diff line number Diff line change @@ -1241,6 +1241,16 @@ namespace nvhttp {
12411241 auto app_image = proc::proc.get_app_image ((int ) util::from_view (get_arg (args, " appid" )));
12421242
12431243 std::ifstream in (app_image, std::ios::binary);
1244+ if (!in.is_open ()) {
1245+ std::error_code ec;
1246+ if (std::filesystem::exists (app_image, ec)) {
1247+ response->write (SimpleWeb::StatusCode::server_error_internal_server_error);
1248+ } else {
1249+ response->write (SimpleWeb::StatusCode::client_error_not_found);
1250+ }
1251+ response->close_connection_after_response = true ;
1252+ return ;
1253+ }
12441254 SimpleWeb::CaseInsensitiveMultimap headers;
12451255 headers.emplace (" Content-Type" , " image/png" );
12461256 response->write (SimpleWeb::StatusCode::success_ok, in, headers);
You can’t perform that action at this time.
0 commit comments