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

internal: non-strict RFC ETag format support

Open borisovdev opened this issue 1 year ago • 8 comments
trafficstars

For some caldav providers, it wasn't possible to unmarshal unquoted text for etag

Referenced to #165, #69

borisovdev avatar Oct 26 '24 12:10 borisovdev

This is non-standard, so not sure I want to maintain this.

This also unnecessarily uses regular expressions, and falls apart when marshaling etags.

emersion avatar Oct 26 '24 12:10 emersion

This is non-standard, so not sure I want to maintain this.

This also unnecessarily uses regular expressions, and falls apart when marshaling etags.

Thanks for the quick reply and your time! Yes, I have already familiarized myself with other similar issues. The reality is that many providers do not strictly follow the RFC in this place. Should we send people to live in a fork just because the rules say so? Often we do, but it seems not in this case. Please give it some thought:)

Thanks for pointing out MarshalText, I should be more careful. I'm marking PR as draft and will finalize it as soon as I have free time.

borisovdev avatar Oct 26 '24 12:10 borisovdev

I like to clarify details, to avoid misunderstandings) We are talking about https://datatracker.ietf.org/doc/html/rfc2616#section-3.11, right?

About the review:

This also unnecessarily uses regular expressions and falls apart when marshaling etags.

  1. removed regexp from implementation
  2. I thought of possible problems with marshaling in my head, but didn't find them. In the extended implementation of UnmarshalText an unquoted string is returned anyway. I added new tests and modified the old one

This is non-standard, so not sure I want to maintain this.

the fate of this item is in your hands:)

Rebased and updated the branch

borisovdev avatar Oct 27 '24 14:10 borisovdev

I also encountered this problem when using DavMail. The edits are very minimal and I don't want to make a fork for this. I am sure that with these changes it will only get better!

Miha-ha avatar Nov 25 '24 13:11 Miha-ha

another option would be to check if the b byte slice has " and " as its first and last bytes, and, if not, add them and proceed as before.

barkyq avatar Jan 12 '25 20:01 barkyq

another comment, if this is used (by changing internal), it also applies to server side, which seems like it would make the servers accept the non-standard behaviour of unquoted etags.

barkyq avatar Jan 15 '25 22:01 barkyq

This Pull requests is great! I now can use CardDAV from Mailbox.org!

Please merge it!

berzdev avatar May 02 '25 23:05 berzdev

This PR treats weak ETags as strong ETags, and breaks when marshaling an ETag value.

emersion avatar May 04 '25 11:05 emersion