Skip to content

Commit 66b3519

Browse files
committed
rename default 404 file to default_404.sql
1 parent fdee601 commit 66b3519

File tree

3 files changed

+6
-5
lines changed

3 files changed

+6
-5
lines changed
File renamed without changes.

src/lib.rs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,7 @@ pub const TEMPLATES_DIR: &str = "sqlpage/templates/";
9797
pub const MIGRATIONS_DIR: &str = "migrations";
9898
pub const ON_CONNECT_FILE: &str = "on_connect.sql";
9999
pub const ON_RESET_FILE: &str = "on_reset.sql";
100+
pub const DEFAULT_404_FILE: &str = "default_404.sql";
100101

101102
pub struct AppState {
102103
pub db: Database,
@@ -121,11 +122,11 @@ impl AppState {
121122
ParsedSqlFile::new(&db, include_str!("../index.sql"), Path::new("index.sql")),
122123
);
123124
sql_file_cache.add_static(
124-
PathBuf::from("_default_404.sql"),
125+
PathBuf::from(DEFAULT_404_FILE),
125126
ParsedSqlFile::new(
126127
&db,
127-
include_str!("../_default_404.sql"),
128-
Path::new("_default_404.sql"),
128+
include_str!("../default_404.sql"),
129+
Path::new(DEFAULT_404_FILE),
129130
),
130131
);
131132

src/webserver/http.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ use crate::webserver::database::execute_queries::stop_at_first_error;
88
use crate::webserver::database::{execute_queries::stream_query_results_with_conn, DbItem};
99
use crate::webserver::http_request_info::extract_request_info;
1010
use crate::webserver::ErrorWithStatus;
11-
use crate::{app_config, AppConfig, AppState, ParsedSqlFile};
11+
use crate::{app_config, AppConfig, AppState, ParsedSqlFile, DEFAULT_404_FILE};
1212
use actix_web::dev::{fn_service, ServiceFactory, ServiceRequest};
1313
use actix_web::error::{ErrorBadRequest, ErrorInternalServerError};
1414
use actix_web::http::header::{ContentType, Header, HttpDate, IfModifiedSince, LastModified};
@@ -383,7 +383,7 @@ pub async fn main_handler(
383383

384384
if prefers_html {
385385
let mut response =
386-
process_sql_request(&mut service_request, PathBuf::from("_default_404.sql"))
386+
process_sql_request(&mut service_request, PathBuf::from(DEFAULT_404_FILE))
387387
.await?;
388388
*response.status_mut() = StatusCode::NOT_FOUND;
389389
Ok(response)

0 commit comments

Comments
 (0)