Fix xDS reference links broken when resource id contains slashes - #1329
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (2)
🚧 Files skipped from review as they are similar to previous changes (1)
📝 WalkthroughWalkthroughAdds a new test file that introduces a ChangesresolveReference Test Suite
Estimated code review effort: 1 (Trivial) | ~3 minutes 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Motivation:
`resolveReference()` built the `id` for navigation links by taking only
the last path segment of a resource name such as
`groups/dx/clusters/centraldogma-oss-mdc/alpha`, producing `alpha`
instead of the correct `centraldogma-oss-mdc/alpha`.
Modifications:
- In `resolveReference()`, replace `segments[segments.length - 1]` with
`segments.slice(idStart).join('/')`, where `idStart` skips the
resource-type prefix (1 for regular paths, 2 for k8s paths).
Result:
- Reference links for resource names containing `/` (e.g.
`groups/dx/clusters/centraldogma-oss-mdc/alpha`) now navigate to the
correct resource.
Yeah, I fixed it in this PR. The previous file has a null byte that Git considers as a binary file. |

Motivation:
resolveReference()built theidfor navigation links by taking only the last path segment of a resource name such asgroups/dx/clusters/centraldogma-oss-mdc/alpha, producingalphainstead of the correctcentraldogma-oss-mdc/alpha.Modifications:
resolveReference(), replacesegments[segments.length - 1]withsegments.slice(idStart).join('/'), whereidStartskips the resource-type prefix (1 for regular paths, 2 for k8s paths).Result:
/(e.g.groups/dx/clusters/centraldogma-oss-mdc/alpha) now navigate to the correct resource.