From 972d42531c64b0bb0e7cc82cfd3252d940075ecc Mon Sep 17 00:00:00 2001 From: evilchili Date: Sat, 18 Oct 2025 16:17:43 -0700 Subject: [PATCH] conditional encoding --- src/grung/types.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/grung/types.py b/src/grung/types.py index 2becdc7..2c67954 100644 --- a/src/grung/types.py +++ b/src/grung/types.py @@ -304,7 +304,9 @@ class FilePointer(Field): relpath = self.relpath(record) path = db.path / relpath path.parent.mkdir(parents=True, exist_ok=True) - path.write_bytes(record[self.name]) + path.write_bytes( + record[self.name] if isinstance(record[self.name], FilePointer.value_type) else record[self.name].encode() + ) record[self.name] = str(relpath)