go-webdav icon indicating copy to clipboard operation
go-webdav copied to clipboard

Allow parse etag without quotes

Open LugaMuga opened this issue 3 years ago • 13 comments
trafficstars

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.

LugaMuga avatar Apr 18 '22 11:04 LugaMuga

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.

emersion avatar Apr 18 '22 20:04 emersion

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.

LugaMuga avatar Apr 19 '22 13:04 LugaMuga

We've already made plenty of breaking changes since the last release.

emersion avatar Apr 22 '22 08:04 emersion

ok, changed patch as you said

LugaMuga avatar May 03 '22 15:05 LugaMuga

String and MarshalText should be dropped as well, otherwise ETags will get double-quoted.

Done

LugaMuga avatar May 03 '22 16:05 LugaMuga

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.

emersion avatar May 11 '22 08:05 emersion

That's why I worried about remove String method. Let's I return it and in server call internal.ETag(ao.ETag).String() ?

LugaMuga avatar May 15 '22 18:05 LugaMuga

string(ao.ETag) should work as well.

emersion avatar May 23 '22 09:05 emersion

Nope. String() method, that I was removed, is adding quotes to ETag value. This is not the same string(ao.ETag)

LugaMuga avatar May 23 '22 16:05 LugaMuga

With your changes, the ETag contains quotes already, no need to add them again.

emersion avatar May 23 '22 16:05 emersion

Where my changes add quotes in code ? w.Header().Set("ETag", ao.ETag)

LugaMuga avatar May 23 '22 16:05 LugaMuga

Removed wrapper, with call String() method on it. I think it will broke server in setting ETag to headers

LugaMuga avatar May 23 '22 16:05 LugaMuga

Could you please explain, why need write type conversion here?

Screenshot 2022-06-14 at 20 57 13

LugaMuga avatar Jun 14 '22 17:06 LugaMuga