mirror of
https://git.sr.ht/~sircmpwn/tokidoki
synced 2025-12-12 14:17:21 +01:00
Handle If-None-Match in PUT requests
As objects always get written to the path that is their UID, we don't have to worry about UID conflicts. Unless, the client creates a new contact, in which case this header should be set.
This commit is contained in:
parent
b2057fe9ef
commit
04a422523a
1 changed files with 4 additions and 2 deletions
|
|
@ -425,7 +425,8 @@ func (b *filesystemBackend) PutAddressObject(ctx context.Context, objPath string
|
|||
return "", err
|
||||
}
|
||||
|
||||
if _, err := os.Stat(localPath); !os.IsNotExist(err) {
|
||||
// TODO handle IfMatch
|
||||
if _, err := os.Stat(localPath); !os.IsNotExist(err) && opts.IfNoneMatch {
|
||||
return "", carddav.NewPreconditionError(carddav.PreconditionNoUIDConflict)
|
||||
}
|
||||
|
||||
|
|
@ -603,7 +604,8 @@ func (b *filesystemBackend) PutCalendarObject(ctx context.Context, objPath strin
|
|||
return "", err
|
||||
}
|
||||
|
||||
if _, err := os.Stat(localPath); !os.IsNotExist(err) {
|
||||
// TODO handle IfMatch
|
||||
if _, err := os.Stat(localPath); !os.IsNotExist(err) && opts.IfNoneMatch {
|
||||
return "", caldav.NewPreconditionError(caldav.PreconditionNoUIDConflict)
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue