From cc42c87d7135206ba23291867e06d24789249de0 Mon Sep 17 00:00:00 2001 From: feiniks <36756310+feiniks@users.noreply.github.com> Date: Sat, 21 Oct 2023 10:23:21 +0800 Subject: [PATCH] Fix empty commit because of encode add a newline (#633) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: 杨赫然 --- fileserver/fsmgr/fsmgr.go | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/fileserver/fsmgr/fsmgr.go b/fileserver/fsmgr/fsmgr.go index 382429a..180c087 100644 --- a/fileserver/fsmgr/fsmgr.go +++ b/fileserver/fsmgr/fsmgr.go @@ -168,7 +168,16 @@ func jsonNoEscape(data interface{}) ([]byte, error) { return nil, err } - return buf.Bytes(), nil + bytes := buf.Bytes() + + // Encode will terminate each value with a newline. + // This makes the output look a little nicer + // when debugging, and some kind of space + // is required if the encoded value was a number, + // so that the reader knows there aren't more + // digits coming. + // The newline at the end needs to be removed for the above reasons. + return bytes[:len(bytes)-1], nil } // SeafDir is a dir object