go-webdav
go-webdav copied to clipboard
Allow parse etag without quotes
Catched issue same like https://github.com/emersion/go-webdav/issues/50. Understand that it's needs when server not working strictly by RFC. But some developers will try to use library for "wrong implemented" servers and get the same error. Think it's possible to make requirement not so strictly in that case.
TBH, maybe we shouldn't do any of the quoting/unquoting stuff. It would be a bit awkward to deal with quoted strings, but at least we wouldn't have this kind of issues and we would handle weak entity tags properly.
Agree. But what will happen with projects, that already use this library? I don't think that they have tests for quotes, and this change can broke them.
We've already made plenty of breaking changes since the last release.
ok, changed patch as you said
StringandMarshalTextshould be dropped as well, otherwise ETags will get double-quoted.
Done
Hm, this new proposal is error-prone. Library users need to "guess" that they need to double-quote the ETag values they're using. It's very easy to break the RFC with this API.
That's why I worried about remove String method. Let's I return it and in server call internal.ETag(ao.ETag).String() ?
string(ao.ETag) should work as well.
Nope. String() method, that I was removed, is adding quotes to ETag value. This is not the same string(ao.ETag)
With your changes, the ETag contains quotes already, no need to add them again.
Where my changes add quotes in code ?
w.Header().Set("ETag", ao.ETag)
Removed wrapper, with call String() method on it. I think it will broke server in setting ETag to headers
Could you please explain, why need write type conversion here?