fix: fixed logdir index out of bounds

This commit is contained in:
imlonghao 2022-01-27 22:25:08 +08:00
parent 6c96967407
commit e3e428ad06
Failed to extract signature
2 changed files with 4 additions and 0 deletions

View file

@ -12,6 +12,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Fixed
- Ensure logir is not null
- Fixed index out of bounds caused by olded ts
### Added

View file

@ -238,6 +238,9 @@ async fn get_pkg_log(
)
.await
.unwrap();
if rows.len() == 0 {
return HttpResponse::BadRequest().body("ts is too old");
}
let logdir: String = rows[0].get("logdir");
let filename = format!("/home/lilydjwg/.lilac/log/{}/{}.log", logdir, name);
let contents = match std::fs::read_to_string(&filename) {