Fix /dav/principals/*/ throwing a server error when accessed with GET instead of PROPFIND (#769)
Co-authored-by: kolaente <k@knt.li> Reviewed-on: https://kolaente.dev/vikunja/api/pulls/769 Co-authored-by: konrad <konrad@kola-entertainments.de> Co-committed-by: konrad <konrad@kola-entertainments.de>
This commit is contained in:
parent
c1ad9d58f5
commit
2447f84e2b
1 changed files with 9 additions and 0 deletions
|
@ -397,6 +397,11 @@ func (vlra *VikunjaListResourceAdapter) CalculateEtag() string {
|
||||||
if vlra.task != nil {
|
if vlra.task != nil {
|
||||||
return `"` + strconv.FormatInt(vlra.task.ID, 10) + `-` + strconv.FormatInt(vlra.task.Updated.Unix(), 10) + `"`
|
return `"` + strconv.FormatInt(vlra.task.ID, 10) + `-` + strconv.FormatInt(vlra.task.Updated.Unix(), 10) + `"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if vlra.list == nil {
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
|
||||||
// This also returns the etag of the list, and not of the task,
|
// This also returns the etag of the list, and not of the task,
|
||||||
// which becomes problematic because the client uses this etag (= the one from the list) to make
|
// which becomes problematic because the client uses this etag (= the one from the list) to make
|
||||||
// Requests to update a task. These do not match and thus updating a task fails.
|
// Requests to update a task. These do not match and thus updating a task fails.
|
||||||
|
@ -439,6 +444,10 @@ func (vcls *VikunjaCaldavListStorage) getListRessource(isCollection bool) (rr Vi
|
||||||
s := db.NewSession()
|
s := db.NewSession()
|
||||||
defer s.Close()
|
defer s.Close()
|
||||||
|
|
||||||
|
if vcls.list == nil {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
can, _, err := vcls.list.CanRead(s, vcls.user)
|
can, _, err := vcls.list.CanRead(s, vcls.user)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
_ = s.Rollback()
|
_ = s.Rollback()
|
||||||
|
|
Loading…
Reference in a new issue