mirror of
https://codeberg.org/Toasterson/ips.git
synced 2026-04-10 13:20:42 +00:00
Refactor whitespace handling in JSON serialization and improve ISO-8601 timestamp formatting
- Removed unnecessary spaces in JSON key-value and array formatting for Python-style compatibility. - Enhanced `format_iso8601_basic` to ensure precise microsecond-level time formatting. - Updated `write_update_log` to return and store SHA-1 signatures for update log verification.
This commit is contained in:
parent
ff0b9f4319
commit
b32ace705f
4 changed files with 7 additions and 8 deletions
2
.replit
2
.replit
|
|
@ -1,2 +0,0 @@
|
||||||
language = "rust"
|
|
||||||
run = "cargo test"
|
|
||||||
|
|
@ -66,7 +66,8 @@ pub type Result<T> = std::result::Result<T, CatalogError>;
|
||||||
/// Format a SystemTime as an ISO-8601 'basic format' date in UTC
|
/// Format a SystemTime as an ISO-8601 'basic format' date in UTC
|
||||||
pub fn format_iso8601_basic(time: &SystemTime) -> String {
|
pub fn format_iso8601_basic(time: &SystemTime) -> String {
|
||||||
let datetime = convert_system_time_to_datetime(time);
|
let datetime = convert_system_time_to_datetime(time);
|
||||||
format!("{}Z", datetime.format("%Y%m%dT%H%M%S.%f"))
|
let micros = datetime.timestamp_subsec_micros();
|
||||||
|
format!("{}.{:06}Z", datetime.format("%Y%m%dT%H%M%S"), micros)
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Convert SystemTime to UTC DateTime, handling errors gracefully
|
/// Convert SystemTime to UTC DateTime, handling errors gracefully
|
||||||
|
|
|
||||||
|
|
@ -2520,7 +2520,7 @@ impl FileBackend {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
let _ = catalog_writer::write_update_log(&update_log_path, &mut update_log)?;
|
let update_log_sig = catalog_writer::write_update_log(&update_log_path, &mut update_log)?;
|
||||||
debug!("Wrote update log file");
|
debug!("Wrote update log file");
|
||||||
|
|
||||||
// Add an update log to catalog.attrs
|
// Add an update log to catalog.attrs
|
||||||
|
|
@ -2529,7 +2529,7 @@ impl FileBackend {
|
||||||
update_log_name.clone(),
|
update_log_name.clone(),
|
||||||
crate::repository::catalog::UpdateLogInfo {
|
crate::repository::catalog::UpdateLogInfo {
|
||||||
last_modified: timestamp.clone(),
|
last_modified: timestamp.clone(),
|
||||||
signature_sha1: None,
|
signature_sha1: Some(update_log_sig),
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue