Fix AsPath for String not normalizing paths#954
Conversation
AsPath for String/&String bypassed Path::new() and directly borrowed the raw string, so trailing slashes were preserved. This caused OriginConsumerNotify to panic when strip_prefix failed on the unnormalized root. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
WalkthroughThis pull request introduces regression tests for 🚥 Pre-merge checks | ✅ 5 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches
🧪 Generate unit tests (beta)
No actionable comments were generated in the recent review. 🎉 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 |
Summary
OriginConsumer::announcedpanics if prefix does not matchAsPath for StringandAsPath for &StringbypassedPath::new()and directly borrowed the raw string, so trailing slashes (e.g."some_prefix/") were preserved without normalizationOriginConsumerNotify::announce/reannounce/unannounceto panic whenstrip_prefixfailed on the unnormalized rootPath::new(), matching the&strimpl behaviorTest plan
test_with_root_trailing_slash_consumer— consumer with trailing-slash String root receives announcementstest_with_root_trailing_slash_producer— producer with trailing-slash String root publishes correctlytest_with_root_trailing_slash_unannounce— unannounce also works with trailing-slash root🤖 Generated with Claude Code