fix: nil slice -> empty slice in list API responses
Backend: - ListStorageJobs, ListSambaShares, ListNFSExports, ListUsers, ListDirty, ListApplyLog, ListWatchedMounts: initialize with make([]T, 0) instead of var x []T to avoid JSON null on empty. Fixes "Cannot read properties of null" crash on /storage. Frontend: - Storage.tsx: defensive setJobs(res.jobs ?? []) to guard against API returning null. Tests: - Add TestListStorageJobsEmptyReturnsSlice. Version: 0.7.1
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
BINARY=nasctl
|
||||
VERSION?=0.7.0
|
||||
VERSION?=0.7.1
|
||||
GO?=go
|
||||
LDFLAGS=-s -w -X github.com/darroyo/nasctl/internal/web.Version=$(VERSION) -X github.com/darroyo/nasctl/internal/web.Commit=$(shell git rev-parse --short HEAD 2>/dev/null || echo unknown)
|
||||
BUILD_FLAGS=CGO_ENABLED=0
|
||||
|
||||
Reference in New Issue
Block a user