text icon indicating copy to clipboard operation
text copied to clipboard

Failed to write to document errors in readonly sessions

Open mejo- opened this issue 2 years ago • 1 comments

Describe the bug When opening Text documents in read-only mode (e.g. shared documents), Text regularly tries to send push messages to the backend that get declined:

POST https://nextcloud.local/index.php/apps/text/public/session/17142/push [HTTP/2 403  66ms]
[ERROR] text: failed to write to document - not allowed
[ERROR] text: Unexpected Error "Failed to apply steps. Retry!" 

To Reproduce Steps to reproduce the behavior:

  1. Open Text document in read-only view (e.g. by sharing the document read-only)
  2. Open the developer console
  3. Maybe you have to click around in the document, not sure about that.
  4. See error

Screenshots 2024-01-10T12:13:11,375500483+01:00

Server details:

  • Nextcloud version: development branch (29.0.0 dev)

mejo- avatar Jan 10 '24 11:01 mejo-

Not sure what is best but I think we have a few options:

  • Do not send out awareness messages on the client side
  • Accept read only users awareness messages on the push endpoint (even with read only)
    • Either ignore any pushed messages
    • Or filter out and only allow pushing awareness messages

juliusknorr avatar Jan 10 '24 19:01 juliusknorr

I don't think we should send awareness messages on a connection that got initiated as read-only (e.g. due to missing write privileges).

My understanding is that we currently don't differentiate between "on purpose read-only" (e.g. when connecting to a document session without write privileges) and "temporary read-only" (e.g due to connectivity issues). In the former case I think we should stop the client from sending any awareness messages. In the latter case we should keep the current logic of throwing an error and retrying later.

mejo- avatar Mar 11 '24 09:03 mejo-