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

[v2] Fallback MOVE by COPY+STORE+EXPUNGE doesn't return DestUIDs

Open Vovan-VE opened this issue 1 year ago • 8 comments

v2.0.0-beta.3

data, err := client.Move(uidset, to).Wait()

The resulting MoveData.DestUIDs gets fulfilled only when real MOVE executed. https://github.com/emersion/go-imap/blob/ee36cf4658d87d2230b6bde0b0c2177b6b4eff96/imapclient/client.go#L848-L852

In case of fallback workflow COPY+STORE+EXPUNGE it remains nil.

Vovan-VE avatar Jun 24 '24 09:06 Vovan-VE

Or wait, it's impossible by RFCs spec?

Vovan-VE avatar Jun 24 '24 09:06 Vovan-VE

Does #624 help?

Note, these fields are only populated if the server supports UIDPLUS.

emersion avatar Jun 24 '24 17:06 emersion

I'll try it and report later. Thanks!

Vovan-VE avatar Jun 24 '24 17:06 Vovan-VE

I just figured out that COPY+STORE+EXPUNGE should already work fine without the PR, if underlying IMAP server supports needed features. Sorry, my fail. I'll check more details better next time. And so DestUIDs will remein empty only when it's really nothing to put there.

However the PR itself should fix independent COPY command, isn't it?

Vovan-VE avatar Jun 25 '24 03:06 Vovan-VE

The patch is supposed to fix the case where the server does not support MOVE, but does support UIDPLUS. There is nothing we can populate the fields with when the server does not support UIDPLUS.

emersion avatar Jun 25 '24 17:06 emersion

Yes, right. I mean your current version without patch already should work fine as far as possible, even when it's MOVE under the hood, because Move().Wait() returns MoveData anyway. However the patch is usefull to fix independent COPY command, when CopyData is returned.

Vovan-VE avatar Jun 25 '24 17:06 Vovan-VE

There's one detail though: this function handles untagged responses only. Tagged responses are handled elsewhere: https://github.com/emersion/go-imap/blob/ee36cf4658d87d2230b6bde0b0c2177b6b4eff96/imapclient/client.go#L711

The RFC specifies that COPY results in a tagged COPYUID response, and MOVE results in an untagged COPYUID response.

emersion avatar Jun 25 '24 18:06 emersion

I gathered CAPABILITIES from underlying accounts, and unfortunely I have no "test subjects" without MOVE support at the moment, so I cannot actually check if the PR does anything.

Vovan-VE avatar Jun 27 '24 12:06 Vovan-VE