fix: some small bugs
							parent
							
								
									6610442bf1
								
							
						
					
					
						commit
						1203a34f8f
					
				|  | @ -13,9 +13,13 @@ RUN wget -O - "https://github.com/Yelp/dumb-init/archive/refs/tags/v${DI_VER}.ta | |||
|     mv dumb-init .. && \ | ||||
|     cd .. | ||||
| 
 | ||||
| COPY Cargo.toml Cargo.lock ./ | ||||
| 
 | ||||
| RUN cargo fetch --locked | ||||
| 
 | ||||
| COPY . ./ | ||||
| 
 | ||||
| RUN cargo build --release | ||||
| RUN cargo build --release --frozen | ||||
| 
 | ||||
| 
 | ||||
| FROM alpine:3.21 | ||||
|  |  | |||
|  | @ -25,6 +25,8 @@ impl Error for ServerError {} | |||
| 
 | ||||
| impl IntoResponse for ServerError { | ||||
|     fn into_response(self) -> Response { | ||||
|         tracing::error!("{}", self); | ||||
| 
 | ||||
|         match self { | ||||
|             ServerError::IO(_) => StatusCode::INTERNAL_SERVER_ERROR.into_response(), | ||||
|             ServerError::Axum(_) => StatusCode::INTERNAL_SERVER_ERROR.into_response(), | ||||
|  |  | |||
|  | @ -32,9 +32,7 @@ pub fn app( | |||
|     // file doesn't exist, then we look for it in the other directories.
 | ||||
|     let serve_dir = ServeDir::new(ctx.static_dir.join(STATIC_ROOT_NAME)) | ||||
|         .append_index_html_on_directories(true) | ||||
|         .not_found_service( | ||||
|             ServeDir::new(ctx.static_dir.clone()).append_index_html_on_directories(true), | ||||
|         ); | ||||
|         .fallback(ServeDir::new(ctx.static_dir.clone()).append_index_html_on_directories(true)); | ||||
| 
 | ||||
|     let mut app = Router::new() | ||||
|         .route_service("/", serve_dir.clone()) | ||||
|  | @ -101,8 +99,13 @@ fn process_archive(ar_path: &Path, dest_dir: &Path) -> io::Result<()> { | |||
|         .unwrap_or(String::from("")); | ||||
|     let new_dir = dest_dir.with_extension(format!("{ext}.new")); | ||||
| 
 | ||||
|     // Directory might be left behind by previous failed upload
 | ||||
|     if new_dir.try_exists()? { | ||||
|         std::fs::remove_dir_all(&new_dir)?; | ||||
|     } | ||||
| 
 | ||||
|     // Unpack archive into new directory
 | ||||
|     std::fs::create_dir(&new_dir)?; | ||||
|     std::fs::create_dir_all(&new_dir)?; | ||||
|     ar.unpack(&new_dir)?; | ||||
| 
 | ||||
|     // Replace original directory with new one
 | ||||
|  |  | |||
		Loading…
	
		Reference in New Issue