Skip to content

drive comments create: anchor field results in 'Original content deleted' in Google Docs #169

@Om3rr

Description

@Om3rr

Description

When creating a comment on a Google Docs file using gws drive comments create with an anchor field, the comment is posted successfully (HTTP 200) but appears in the Google Docs UI as "Original content deleted" instead of being anchored to the specified text.

Steps to Reproduce

gws drive comments create \
  --params '{"fileId": "<DOC_ID>", "fields": "id,content,anchor,quotedFileContent"}' \
  --json '{
    "content": "Hello",
    "quotedFileContent": {
      "mimeType": "text/plain",
      "value": "Overview"
    },
    "anchor": "{\"r\":\"head\",\"a\":[{\"lt\":\"b\",\"lv\":\"Overview\"}]}"
  }'

Expected Behavior

The comment should be anchored to the matching text in the document, or the CLI/docs should clearly indicate that anchored comments are not supported for Google Docs files via the API.

Actual Behavior

The API returns a 200 with the anchor saved, but the comment appears in the Google Docs UI as "Original content deleted" — no text is highlighted and the anchor has no visible effect.

Additional Context

  • This appears to be a known Google Drive API limitation: for Google Workspace editor files (Docs, Sheets, Slides), the anchor field is saved but ignored by the editor UI. See the official docs: "The anchor is saved and returned when retrieving the comment, however Google Workspace editor apps treat these comments as un-anchored comments."
  • It would be helpful if gws surfaced a warning when using anchor on a application/vnd.google-apps.kix (Google Docs) file, since the result is misleading.
  • gws version: 0.4.4

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions