Open
Description
go version: 1.24.0
version tailscale.com/client/tailscale/v2 v2.0.0-20250509161557-5fad10cf3a33
My code is like:
acl, err := ts.PolicyFile().Get(context.TODO())
Expect(err).To(BeNil())
// modify acl here
err = ts.PolicyFile().Set(context.TODO(), *acl, acl.ETag)
Expect(err).To(BeNil())
And I got an error: precondition failed, invalid old hash (412)
.
The root cause is using fmt.Sprintf("%q", etag)
to set the etag header in the Set
function, it adds extra double quotes.
tailscale-client-go-v2/policyfile.go
Line 201 in 5fad10c
So, now I have to remove double quotes before calling the Set
function, like:
etag := strings.Trim(acl.ETag, "\"")
err = ts.PolicyFile().Set(context.TODO(), *acl, etag)
Metadata
Metadata
Assignees
Labels
No labels