Repository navigation
fix(viewer): pass canCompare as a function - #6321
Merged
Merged
Conversation
@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
approved these changes
Nov 10, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
On server master, which ships
@nextcloud/viewer2.0.0-beta.20, the versions tab never offers Compare for Office files. Since beta.18 a handler'scanCompareis a function (nextcloud-libraries/nextcloud-viewer#133). WithcanCompare: truethe 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 answeringcanView()andcanCompare(). Before, beta.17 gives no Compare and beta.20 fails to register. After, both register and offer Compare.Checklist
AI