Fix Ls2JsonWriter

by allowing more spaces in the ls response.
by sending the error response of the list file system route only when no content has been written.
This commit is contained in:
Maximilian Paß
2022-10-04 13:45:24 +01:00
parent 195f88177e
commit 3509109b6f
2 changed files with 16 additions and 9 deletions

View File

@ -15,7 +15,8 @@ import (
var (
log = logging.GetLogger("nullio")
pathLineRegex = regexp.MustCompile(`(.*):$`)
headerLineRegex = regexp.MustCompile(`([-aAbcCdDlMnpPsw?])([-rwxXsStT]{9})([+ ])\d+ (.+?) (.+?) +(\d+) (\d+) (.*)$`)
headerLineRegex = regexp.
MustCompile(`([-aAbcCdDlMnpPsw?])([-rwxXsStT]{9})(\+?) +\d+ +(.+?) +(.+?) +(\d+) +(\d+) +(.*)$`)
)
const (
@ -39,6 +40,10 @@ type Ls2JsonWriter struct {
latestPath []byte
}
func (w *Ls2JsonWriter) HasStartedWriting() bool {
return w.jsonStartSent
}
func (w *Ls2JsonWriter) Write(p []byte) (int, error) {
i, err := w.initializeJSONObject()
if err != nil {