Skip to content

fix(viewer): pass canCompare as a function - #6321

Merged
elzody merged 1 commit into
mainfrom
fix/viewer-can-compare-function
Nov 10, 2026
Merged

elzody merged 1 commit into
mainfrom
fix/viewer-can-compare-function

Conversation

@hweihwang

Copy link
Copy Markdown
Contributor
  • Target version: main

Summary

On server master, which ships @nextcloud/viewer 2.0.0-beta.20, the versions tab never offers Compare for Office files. Since beta.18 a handler's canCompare is a function (nextcloud-libraries/nextcloud-viewer#133). With canCompare: true the viewer logs "The richdocuments handler could not tell whether comparing is worth offering" and answers no. Office files still open.

The Dependabot updates #6233 and #6300 would break more: from beta.18 on, registerHandler() throws "Handler canCompare must be a function if provided", and the viewer can no longer open Office files.

This passes canCompare: () => true, which works with beta.17, the version this app ships, and with beta.20.

Tested with the real library: the handler from src/init-viewer.js, registered through beta.17 and through beta.20, with the server's beta.20 answering canView() and canCompare(). Before, beta.17 gives no Compare and beta.20 fails to register. After, both register and offer Compare.

Checklist

  • Code is properly formatted
  • Sign-off message is added to all commits
  • Documentation (manuals or wiki) has been updated or is not required

AI

  • Prepared with AI assistance.

@nextcloud/viewer 2.0.0-beta.18 made a handler's canCompare a function
that gets the files. The server ships beta.20: its versions tab gets a
TypeError from canCompare: true and never offers Compare for Office
files. Bumping the library here would make registerHandler() throw and
leave Office files without a viewer handler.

Assisted-by: ClaudeCode:claude-opus-5-5
Signed-off-by: Hoang Pham <hoangmaths96@gmail.com>
@elzody
elzody merged commit eb45dd2 into main Nov 10, 2026
40 of 42 checks passed
@elzody
elzody deleted the fix/viewer-can-compare-function branch November 10, 2026 19:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants