Skip to content

Conversation

@joshtrichards
Copy link
Member

@joshtrichards joshtrichards commented Feb 2, 2026

  • Target version: main

Summary

tldr: Additional error checking and logging for increased robustness and troubleshooting ease; refactoring to generalize proof key extraction (common code). Oh, and adds request-level caching.

  • Configuration validation:
    getDiscoveryEndpoint() now checks if the wopi_url configuration is present; logs an error and throws a RuntimeException if missing, preventing silent misconfiguration.

  • Robust proof key extraction:
    extractProofKey() now explicitly checks that the XPath result is an array and that the required attribute exists before dereferencing. This prevents unexpected warnings or errors if the XML is malformed or attributes are missing.

  • Reduction of magic strings:
    All XPath expressions and attribute names are now class constants for easier maintenance and error prevention.

  • Enhanced documentation and comments:
    Improved docblocks and comments clarify method purposes and implementation details.

  • Improved logging:
    Increased logging coverage for error and debug cases, aiding diagnostics and transparency.

  • Caching and future readiness:
    The parsed discovery XML is cached per request, and the code is prepared for optional future XML namespace handling.


This refactor improves resilience and maintainability of the WOPI discovery proof key handling logic.

TODO

  • ...

Checklist

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

…tainability

Signed-off-by: Josh <josh.t.richards@gmail.com>
@joshtrichards joshtrichards added enhancement New feature or request 3. to review Ready to be reviewed labels Feb 2, 2026
Signed-off-by: Josh <josh.t.richards@gmail.com>
Signed-off-by: Josh <josh.t.richards@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

3. to review Ready to be reviewed enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants