Read the local library list as JSON instead of splitting columns

get_local_libraries unpacked "line.rsplit(maxsplit=3)" into three names, but
maxsplit=3 yields up to four fields. seaf-cli prints "name id path" separated
by whitespace, so any library whose name contains a space produced a fourth
field and raised ValueError, which nothing caught.

The failure only appeared after the first run: the list is empty until a
library has been synced, so a container would work when it was set up and then
crash on every restart.

seaf-cli list --json returns name, id and path as structured fields, which
display output cannot represent unambiguously for names or paths containing
whitespace. Its exit code is now checked and unreadable output is reported as
a daemon error instead of a traceback.

The image smoke check asserts that the installed seaf-cli offers --json and
--token, so a future version bump that drops either fails the build rather
than the container.
This commit is contained in:
Maxim Shulga committed 2026-08-02 17:29:51 -07:00
1 parent 8043ac1409
commit b75863ba51
4 files changed
+73 -9

No files matched your search

+2
View File
@@ -68,6 +68,8 @@ RUN chmod +x /dsc/start.py && \
# Smoke checks: seaf-cli has no --version flag, so assert its subcommands, and
# confirm the app's own imports resolve.
RUN seaf-cli --help | grep -q 'download-by-name' && \
seaf-cli sync --help | grep -q '\--token' && \
seaf-cli list --help | grep -q '\--json' && \
python3 -c "import seafile, pysearpc, dsc.client, dsc.misc"
VOLUME /dsc/seafile-data