Skip to content

refactor(wopi): postFile override handling into helpers and streamline logic#5621

Open
joshtrichards wants to merge 4 commits intomainfrom
jtr/refactor-wopi-postFile
Open

refactor(wopi): postFile override handling into helpers and streamline logic#5621
joshtrichards wants to merge 4 commits intomainfrom
jtr/refactor-wopi-postFile

Conversation

@joshtrichards
Copy link
Copy Markdown
Member

@joshtrichards joshtrichards commented May 1, 2026

  • Target version: main

Summary

Refactor WopiController::postFile() to make WOPI override handling easier to follow by separating the main branches into focused helper methods for:

  • RenameFile
  • PutRelativeFile
  • write-context validation

This turns postFile() into a clearer orchestrator and reduces the amount of mixed logic in the main controller method.

Notes

  • Preserves existing behavior for WOPI lock operations
  • Keeps RenameFile and PutRelativeFile paths isolated
  • Improves readability and maintainability of the shared controller flow
  • Returns HTTP_BAD_REQUEST for unsupported WOPI override values
  • Fixes the RenameFile response shape so it no longer matches PutRelativeFile

The newly introduced resolveWopiWriteContext() helper can be used for future refactoring the various other WOPI operations handling paths in this class, eliminating a lot of boilerplate/duplication.

TODO

  • Make sure nothing breaks (in theory this should be a non-eventful change externally...)
  • Double-check tests
  • Possibly add additional tests/coverage

Checklist

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

Signed-off-by: Josh <josh.t.richards@gmail.com>
weird

Signed-off-by: Josh <josh.t.richards@gmail.com>
Signed-off-by: Josh <josh.t.richards@gmail.com>
Signed-off-by: Josh <josh.t.richards@gmail.com>
@joshtrichards joshtrichards added the 3. to review Ready to be reviewed label May 1, 2026
@joshtrichards joshtrichards marked this pull request as ready for review May 1, 2026 18:10
@joshtrichards joshtrichards changed the title refactor(wopi): postFile override handling into helpers refactor(wopi): postFile override handling into helpers and streamline logic May 1, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant