ffs icon indicating copy to clipboard operation
ffs copied to clipboard

Empty file mounting fails

Open nkh opened this issue 2 years ago • 3 comments

$> touch x.json $> ffs x.son thread 'main' panicked at 'JSON: Error("EOF while parsing a value", line: 1, column: 0)', src/format.rs:187:53 note: run with RUST_BACKTRACE=1 environment variable to display a backtrace

nkh avatar Jan 10 '22 15:01 nkh

What did you expect to happen when you supplied invalid JSON?

(NB that a .json file must contain exactly one value in the sense of RFC 8259.)

mgree avatar Jan 11 '22 15:01 mgree

given the RFC the output is certainly OK but intuitively I would have expected an empty directory

nkh avatar Jan 12 '22 00:01 nkh

If that's what you want, there's the --empty flag.

That said, I'd accept a PR that implemented your behavior---you'd have to catch the error, identify that it's because of an empty file (parse error message/call stat?), and then return an empty object. Might be good to create a --strict flag that turns off this behavior, in case someone wants to rely on correct JSON/etc. parsing.

mgree avatar Jan 12 '22 02:01 mgree