fix(FaceRoot): allow getChild to find face photos by plain filename#1536
Open
manuviens wants to merge 1 commit into
Open
fix(FaceRoot): allow getChild to find face photos by plain filename#1536manuviens wants to merge 1 commit into
manuviens wants to merge 1 commit into
Conversation
When the Photos app sends a MOVE request, it references children by
their basename only (e.g. `photo.jpg`), not by the internal
`{detectionId}-{filename}` pattern that getChild() expected.
This caused a 404 on the source node for `unassigned-faces → faces`
moves and on named clusters for `faces → faces` reassignments, even
though the server-side moveInto() would succeed.
Fix:
- In the cached-children path, fall back to matching
`$child->getFile()->getName()` when the primary
`$child->getName()` match fails.
- In the direct-DB path, guard with `is_numeric($detectionId)`
before the numeric lookup, then fall back to filtering detections
by `findByClusterId` + filecache `getName()`.
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.
Problem
When Nextcloud Photos sends a MOVE request to merge faces, it references children by their basename only (e.g.
photo.jpg), not by the internal{detectionId}-{filename}pattern. This means a MOVE to/recognize/{userId}/faces/{cluster}/photo.jpgfails with 404 becauseFaceRoot::getChild('photo.jpg')cannot find the child.The server-side moveInto() would succeed, but the DAV layer returns 404 on the source lookup, causing Photos to display an error (TypeError in
n.faceDetections.find(d => d.title === u)) even though the operation completed on the server.Fix
Two fallback paths added to
getChild():Cached-children path (when
$this->childrenis already populated): after the primary match fails, iterate again and compare against$child->getFile()->getName().Direct-DB path (when cache is empty): guard with
is_numeric($detectionId)before the numeric lookup to avoid breaking on plain filenames. If not numeric, queryfindByClusterId()and filter results by$file->getName()matching the requested basename.Tested in production on Nextcloud 34 / Recognize 12.0.0. All MOVE operations return HTTP 201/204 and merges complete correctly.