Skip to content

feat(capabilities): dynamic mimetype discovery from wopi xml#5754

Open
multiphlow wants to merge 3 commits into
nextcloud:mainfrom
multiphlow:feat/5742-dynamic-mimetype-discovery
Open

feat(capabilities): dynamic mimetype discovery from wopi xml#5754
multiphlow wants to merge 3 commits into
nextcloud:mainfrom
multiphlow:feat/5742-dynamic-mimetype-discovery

Conversation

@multiphlow

@multiphlow multiphlow commented Jun 10, 2026

Copy link
Copy Markdown

Fixes #5742. This PR introduces dynamic mimetype discovery by parsing the WOPI discovery.xml using XPath, fallback in Capabilities is the static mimetypes array to ensure core stability.

Note: There are still some files in the code where Capabilities::MIMETYPES is used. This has to be correctly changed via dependency injection to use the new dynamic obtaining of the MIMETYPES
Furthermore a/some UnitTest(s) would also be required in DiscoveryServiceTest class.

Further on the discovery endpoint does not yet provide categories for the mimetypes.

@multiphlow multiphlow force-pushed the feat/5742-dynamic-mimetype-discovery branch from 97602f5 to 2ffa5bf Compare June 10, 2026 20:21
@elzody

elzody commented Jun 10, 2026

Copy link
Copy Markdown
Collaborator

Thanks for opening your first pull request here, it means a lot that you want to contribute. This change is especially welcome.

In order to get this in, it would be nice if you could address the following:

  1. Resolve the @todo notes still left in the code
  2. Add some tests to ensure the MIME types from the discovery XML are parsed correctly
  3. Adjust the currently failing tests as the failures seem to be related to this change

If you need help with any of those, please feel free to reach out; I'm more than happy to assist!

@elzody elzody added enhancement New feature or request php Pull requests that update Php code labels Jun 10, 2026
@juliusknorr

juliusknorr commented Jun 11, 2026

Copy link
Copy Markdown
Member

Cypress and integration tests seem to be not running properly with the branch being on a fork, so they are fine to ignore for now.

Actually the cypress failures seem indeed related and seem to tigger a javascript error:

  8) Open existing office files
       Notebookbar UI: Open drawing.odg the viewer on file click:
     Error: The following error originated from your application code, not from Cypress.

  > Handler needs a valid mime array or mimesAliases

When Cypress detects uncaught errors originating from your application it will automatically fail the current test.

This behavior is configurable, and you can choose to turn this off by listening to the `uncaught:exception` event.

https://on.cypress.io/uncaught-exception-from-application
      at validateHandler (http://172.17.0.1:8081/apps/richdocuments/js/richdocuments-init-viewer.js?v=f5f31c4f-0:191:15)
      at registerHandler (http://172.17.0.1:8081/apps/richdocuments/js/richdocuments-init-viewer.js?v=f5f31c4f-0:170:5)
      at <unknown> (http://172.17.0.1:8081/apps/richdocuments/js/richdocuments-init-viewer.js?v=f5f31c4f-0:488:67)
      at <unknown> (http://172.17.0.1:8081/apps/richdocuments/js/richdocuments-init-viewer.js?v=f5f31c4f-0:489:3)
      at <unknown> (http://172.17.0.1:8081/apps/richdocuments/js/richdocuments-init-viewer.js?v=f5f31c4f-0:491:12)

@multiphlow multiphlow force-pushed the feat/5742-dynamic-mimetype-discovery branch from 46efc8f to 497cf2d Compare June 11, 2026 12:01
@multiphlow

Copy link
Copy Markdown
Author

@juliusknorr A while ago I fixed the issue with array_unique.
@elzody For now this is ok, since it is a first coding task ;)

Signed-off-by: Florian Wagner <f.wagner81@gmail.com>
Signed-off-by: Florian Wagner <f.wagner81@gmail.com>
Signed-off-by: Florian Wagner <f.wagner81@gmail.com>
@multiphlow multiphlow force-pushed the feat/5742-dynamic-mimetype-discovery branch from e61b85b to b3827c3 Compare June 12, 2026 19:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request php Pull requests that update Php code

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Migrate static mimetype list to dynamic discovery via WOPI

3 participants