fix(workspace): reuse WorkspaceService file lookup in direct()#8507
Open
joshtrichards wants to merge 6 commits intomainfrom
Open
fix(workspace): reuse WorkspaceService file lookup in direct()#8507joshtrichards wants to merge 6 commits intomainfrom
joshtrichards wants to merge 6 commits intomainfrom
Conversation
…ervice 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>
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>
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
The
direct()action had a privategetFile()helper that duplicated file-discovery logic already implemented inWorkspaceService::getFile().This caused
direct()to behave differently fromfolder()andpublicFolder()in one important way: the private helper usedcontinuerather than an earlyreturn, so it returned the last matched file in the priority-ordered filename list rather than the first.WorkspaceService::getFile()correctly returns on the first match.By switching
direct()toWorkspaceService::getFile(), it now also benefits from the service’s cache-based lookup and storage-invalid handling.Changes
WorkspaceController::getFile()direct()with$this->workspaceService->getFile()use OCP\Files\Fileimport@copyright/@author/@licensedocblock intothe existing SPDX header
Testing
Add minimal unit coverage for
WorkspaceService::getFile()to verify:nulldirect()now reuses the same lookup implementation asfolder()andpublicFolder().P.S. The namespaces used for our unit test classes in this repo are inconsistent; not a functional problem but some are in a clearly dedicated "test" space while others use production code namespaces.
🖼️ Screenshots
🚧 TODO
🏁 Checklist
npm run lint/npm run stylelint/composer run cs:check)