Skip to content

WOPI with Euro-Office: implementation plan for host-side gaps #224

Open

Description

@moodyjmz

Opening, editing and saving work. Save As, PDF form submit, convert-and-edit, review and comment-only modes, UI language and save-type versioning don't. Below, the gaps are ordered by what breaks for users first. Part of #11; the baseline is feat/wopi-phase-5 (#8) at 64a993f, compared against the Euro-Office server at d1936a04.

The plan covers only what EO actually reads or calls. Collabora-only features, and MS-WOPI features EO never calls, are out of scope here.

Phase 1: EO calls that fail today

  • PutRelativeFile with X-WOPI-SuggestedTarget. EO uses it for Save As, download-as-save, PDF form submit and convert-and-edit; the host answers 501. EO sends only SuggestedTarget (extension-only or full name), plus X-WOPI-FileConversion: true for convert-and-edit. It reads only HostEditUrl from the response (convert-and-edit navigates to it); for Save As it only checks that the call succeeded. Once this lands, UserCanNotWriteRelative can go to false.
  • X-WOPI-MaxExpectedSize → 412 on GetFile. EO sends it on every GetFile (default 500 MB, FileConverter.converter.maxDownloadBytes); the host ignores it.
  • UI language. The host strips every <…> placeholder from urlsrc and appends only wopisrc and access_token. EO reads lang or ui for the editor language and the new-file template locale, so it looks like every user gets EO's default. Substitute ui/rs from the user's Nextcloud language. Theme (thm) can follow; EO passes it through to the page but doesn't read it server-side.

Phase 2: permission modes

  • Review and comment-only. EO builds its permissions from UserCanWrite, ReadOnly, UserCanReview, SupportsReviewing and UserCanOnlyComment. The host emits only UserCanWrite, so a share is either full edit or read-only. This needs a decision on the Nextcloud side first: core shares have no comment or review permission, so the mapping (a share attribute? a per-share option in the sharing UI?) is the real work. The emitting part is small.
  • CheckFileInfo fields EO reads but the host doesn't send:
    • ReadOnly (clears edit, and with it comment and fill-forms)
    • FileExtension (overrides the extension from BaseFileName)
    • FileNameMaxLength (EO truncates rename requests to it; default 255)
    • HidePrintOption (EO ORs it with DisablePrint)
    • CopyPasteRestrictions (CurrentDocumentOnly / BlockAll; EO doesn't read DisableCopy)
    • BreadcrumbDocName (EO prefers it over BaseFileName as the title)

Phase 3: save semantics

  • Save-type headers. EO sends X-LOOL-WOPI-IsModifiedByUser, X-LOOL-WOPI-IsAutosave and X-LOOL-WOPI-IsExitSave (the X-LOOL- prefix, not X-COOL-), and going by the code only with the value true: in the run, a false flag arrived as a missing header. A timed save carries IsAutosave and IsModifiedByUser; the save when the last user leaves carries IsExitSave and IsModifiedByUser. Reading both prefixes (absent = false) should let the host create versions on exit saves rather than on every PutFile.
  • Attribute saves to the editing user. EO sends the last editor's user id in X-WOPI-Editors on each PutFile; the host ignores it. Using it would put the right user on the version and in activity.
  • External change during a session. The host's WOPI lock is advisory (its own table), so a WebDAV PUT during an editing session succeeds and this can happen in normal use. On an X-LOOL-WOPI-Timestamp mismatch the host currently saves EO's content and logs a warning; the external version survives in the file's versions. That stopgap is right for now: answering 409 instead made EO show a generic save error, and in that run no further save arrived during the session and the exit save failed with the same stale timestamp, so the edits didn't reach Nextcloud. A conflict copy (write EO's content to a new file and keep the external change in place) would keep both versions in plain sight.

Phase 4: Nextcloud integration

  • New files from templates. The app registers no template creator or provider. EO honours TemplateSource: it fetches the template, then force-saves the content into the target. That gives "new from template" without the host writing the content itself.
  • Previews and conversion. EO exposes Collabora-compatible /cool/convert-to/:format and /lool/convert-to/:format. A preview provider and a conversion or TaskProcessing provider can use them.
  • Editor capabilities. EO serves /hosting/capabilities (product version, hasTemplateSource, hasMobileSupport, convert-to endpoint), linked from discovery. Fetching it gives version detection and feature gating; exposing the result through an OCS capabilities provider would let clients see it.
  • Mobile. EO advertises mobileView/mobileEdit actions (?mobile=1). The host never picks them, and there is no DirectEditing provider for the mobile apps.
  • PDF forms. EO advertises a formsubmit action for fillable forms; submit is a PutRelativeFile, so this follows Phase 1.
  • Admin settings. Per-group enable/edit restrictions.

Small conformance items

  • Read-only users get the edit urlsrc. In the run EO fell back to view mode without sending LOCK (separate document key) and logged a warning, so nothing breaks; picking the view action would avoid relying on that fallback.
  • An unknown access token returns 403; MS-WOPI expects 401. EO doesn't distinguish (it logs the status only), so this is for other WOPI clients and the validator.
  • Discovery: EO emits a single net-zone whose name is configurable (wopi.wopiZone, default external-http). The host takes the first match across zones; fine for EO, but worth a zone preference before other clients are supported.
Where this sits in the code

Host, at 64a993f:

Euro-Office server, at d1936a04:

Repro (office at 64a993f, Euro-Office documentserver:latest-dev with WOPI_ENABLED=true, autoAssembly at 1 min, WOPI request headers logged at the host):

  • Save-type headers: open a document, type, wait for a timed save, close.
  • External change: open a document, type, overwrite the file over WebDAV (the PUT succeeds), type, wait for a timed save, close. Then the same with the host patched to answer 409 on an X-LOOL-WOPI-Timestamp mismatch.
  • Read-only fallback: open the document through a read-only share and through a read-only public link; no LOCK arrives.

The other items come from reading the code at these commits; corrections welcome.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature requestintegrationCompatibility with other apps/systems

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions