Skip to content

Commit

Permalink
fix initialization of shares json file
Browse files Browse the repository at this point in the history
Signed-off-by: David Christofas <dchristofas@owncloud.com>
  • Loading branch information
David Christofas committed Jul 6, 2020
1 parent 6e75598 commit ae3a184
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions pkg/share/manager/json/json.go
Original file line number Diff line number Diff line change
Expand Up @@ -70,8 +70,8 @@ func New(m map[string]interface{}) (share.Manager, error) {
}

func loadOrCreate(file string) (*shareModel, error) {
_, err := os.Stat(file)
if os.IsNotExist(err) {
info, err := os.Stat(file)
if os.IsNotExist(err) || info.Size() == 0 {
if err := ioutil.WriteFile(file, []byte("{}"), 0700); err != nil {
err = errors.Wrap(err, "error opening/creating the file: "+file)
return nil, err
Expand Down

0 comments on commit ae3a184

Please sign in to comment.