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
@ -425,7 +425,8 @@ func (b *filesystemBackend) PutAddressObject(ctx context.Context, objPath string
|
|||||||
return "", err
|
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)
|
return "", carddav.NewPreconditionError(carddav.PreconditionNoUIDConflict)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -603,7 +604,8 @@ func (b *filesystemBackend) PutCalendarObject(ctx context.Context, objPath strin
|
|||||||
return "", err
|
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)
|
return "", caldav.NewPreconditionError(caldav.PreconditionNoUIDConflict)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user