aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBenedikt Peetz <benedikt.peetz@b-peetz.de>2026-06-14 02:19:36 +0200
committerBenedikt Peetz <benedikt.peetz@b-peetz.de>2026-06-14 02:19:36 +0200
commit678eaf1a36c2d96933b1f6f8db7edd39680d2ca2 (patch)
tree190b125528aab55ed9cf235ebd64d640caf0be2a
parentfix(package.nix): Add a (kinda arbitrary) version number (diff)
downloadatuin-main.zip
fix(client/settings): Trim sync user_id and encryption_keyHEADmain
The files might be newline delimited, which we should remove before we try to parse the contents.
Diffstat (limited to '')
-rw-r--r--crates/turtle/src/atuin_client/record/sync.rs2
-rw-r--r--crates/turtle/src/atuin_client/settings.rs7
2 files changed, 7 insertions, 2 deletions
diff --git a/crates/turtle/src/atuin_client/record/sync.rs b/crates/turtle/src/atuin_client/record/sync.rs
index 3057bb10..b12d96c1 100644
--- a/crates/turtle/src/atuin_client/record/sync.rs
+++ b/crates/turtle/src/atuin_client/record/sync.rs
@@ -23,7 +23,7 @@ pub(crate) enum SyncError {
#[error("operational error: {msg:?}")]
OperationalError { msg: String },
- #[error("a request to the sync server failed: {msg:?}")]
+ #[error("a request to the sync server failed: {msg}")]
RemoteRequestError { msg: String },
#[error(
diff --git a/crates/turtle/src/atuin_client/settings.rs b/crates/turtle/src/atuin_client/settings.rs
index 98829529..9e14c4c8 100644
--- a/crates/turtle/src/atuin_client/settings.rs
+++ b/crates/turtle/src/atuin_client/settings.rs
@@ -834,12 +834,17 @@ impl Sync {
pub(crate) fn user_id(&self) -> Result<Option<Uuid>> {
Self::try_read_file(self.user_id_path.as_ref())?
- .map(|file| Uuid::try_parse(&file).map_err(Into::into))
+ .map(|file| {
+ Uuid::parse_str(file.trim()).context(
+ "Failed to decode user id as UUID, while trying to decode sync user_id",
+ )
+ })
.transpose()
}
pub(crate) fn encryption_key(&self) -> Result<Option<Key>> {
Self::try_read_file(self.encryption_key_path.as_ref())?
.as_deref()
+ .map(str::trim)
.map(decode_key)
.transpose()
}