Set content length propery for DAV objects

This makes collections play nice with clients that require it, like
cadaver.
This commit is contained in:
Conrad Hoffmann 2022-05-17 15:28:09 +02:00
parent 5a6306bd83
commit a734b3b532
3 changed files with 23 additions and 19 deletions

View file

@ -295,10 +295,11 @@ func (b *filesystemBackend) GetAddressObject(ctx context.Context, objPath string
}
obj := carddav.AddressObject{
Path: objPath,
ModTime: info.ModTime(),
ETag: etag,
Card: card,
Path: objPath,
ModTime: info.ModTime(),
ContentLength: info.Size(),
ETag: etag,
Card: card,
}
return &obj, nil
}
@ -332,10 +333,11 @@ func (b *filesystemBackend) loadAllContacts(ctx context.Context, propFilter []st
}
obj := carddav.AddressObject{
Path: path.Join(homeSetPath, filepath.Base(filename)),
ModTime: info.ModTime(),
ETag: etag,
Card: card,
Path: path.Join(homeSetPath, filepath.Base(filename)),
ModTime: info.ModTime(),
ContentLength: info.Size(),
ETag: etag,
Card: card,
}
result = append(result, obj)
return nil
@ -376,10 +378,11 @@ func (b *filesystemBackend) loadAllCalendars(ctx context.Context, propFilter []s
}
obj := caldav.CalendarObject{
Path: path.Join(homeSetPath, filepath.Base(filename)),
ModTime: info.ModTime(),
ETag: etag,
Data: cal,
Path: path.Join(homeSetPath, filepath.Base(filename)),
ModTime: info.ModTime(),
ContentLength: info.Size(),
ETag: etag,
Data: cal,
}
result = append(result, obj)
return nil
@ -548,10 +551,11 @@ func (b *filesystemBackend) GetCalendarObject(ctx context.Context, objPath strin
}
obj := caldav.CalendarObject{
Path: objPath,
ModTime: info.ModTime(),
ETag: etag,
Data: calendar,
Path: objPath,
ModTime: info.ModTime(),
ContentLength: info.Size(),
ETag: etag,
Data: calendar,
}
return &obj, nil
return nil, fmt.Errorf("not implemented")