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:
1 parent
8043ac1409
commit
b75863ba51
4 files changed
+73
-9
No files matched your search
+4
-1
@@ -152,7 +152,10 @@ Acceptance criteria:
|
||||
server errors separately.
|
||||
- [ ] Make TLS configuration consistent between Python requests and Seafile.
|
||||
- [ ] Support a custom CA bundle; keep certificate disabling as a last resort.
|
||||
- [ ] Prefer structured JSON output from `seaf-cli` over parsing display text.
|
||||
- [x] Prefer structured JSON output from `seaf-cli` over parsing display text.
|
||||
`seaf-cli list --json` is used instead of splitting the display columns,
|
||||
which could not represent a library name or a path containing whitespace.
|
||||
`list-remote` still uses the HTTP API rather than the CLI.
|
||||
- [ ] Reject ambiguous library names and an empty requested library set.
|
||||
|
||||
### Runtime hardening
|
||||
|
||||
Reference in new issue
Block a user