Fix 500 when every wiki page link fails to resolve - #24770
Open
jtauschl wants to merge 1 commit into
Open
Conversation
When every link's identifier fails to resolve via the page-info query,
metadata ends up empty; enrich_models still tried to build a
LEFT JOIN (VALUES #{placeholders}) with zero placeholders, producing
the invalid SQL fragment "LEFT JOIN (VALUES )" and crashing with a
Postgres syntax error instead of returning the links with a nil title
(which is what happens for any individual link whose resolution
fails when at least one other link in the same request succeeds).
Return the relation directly with a NULL title column when metadata
is empty, matching the shape callers already get from the non-empty
path.
|
All contributors have signed the CLA ✍️ ✅ |
Author
|
recheck |
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
Fixes the crash described in OP-19928 (points 2 and 3 of that report -- point 1's original framing about identifier semantics has been corrected in a follow-up comment there and does not apply to this fix).
When every link's identifier fails to resolve via the page-info query,
metadataends up empty.enrich_modelsstill tried to build aLEFT JOIN (VALUES #{placeholders})with zero placeholders, producing the invalid SQL fragmentLEFT JOIN (VALUES )and crashing with a Postgres syntax error, instead of returning the links with a nil title (which is what already happens for any individual link whose resolution fails when at least one other link in the same request succeeds).Change
Return the relation directly with a
NULLtitle column whenmetadatais empty, matching the shape callers already get from the non-empty path.Test plan
GETon a work package with one unresolvable-identifier link returned 500; after the fix, it returns 200 with the link's title absent