From f633b04d3c5ce139ba182ab42140bd2e221f7f83 Mon Sep 17 00:00:00 2001 From: Gwilym Inzani Date: Wed, 3 Apr 2024 11:08:31 +0100 Subject: [PATCH] Allow passing the URL too since that's easier to copy-paste --- agb-addr2line/src/gwilym_encoding.rs | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/agb-addr2line/src/gwilym_encoding.rs b/agb-addr2line/src/gwilym_encoding.rs index fca9896c..16c83878 100644 --- a/agb-addr2line/src/gwilym_encoding.rs +++ b/agb-addr2line/src/gwilym_encoding.rs @@ -34,6 +34,10 @@ pub struct GwilymDecodeIter<'a> { impl<'a> GwilymDecodeIter<'a> { fn new(input: &'a str) -> anyhow::Result { + let input = input + .strip_prefix("https://agbrs.dev/crash#") + .unwrap_or(input); + let Some((input, version)) = input.rsplit_once('v') else { anyhow::bail!("Does not contain version"); }; @@ -161,4 +165,14 @@ mod test { Ok(()) } + + #[test] + fn should_strip_the_agbrsdev_prefix() -> anyhow::Result<()> { + assert_eq!( + &gwilym_decode("https://agbrs.dev/crash#2QI65Q69306Kv1")?.collect::>(), + &[0x0800_16d3, 0x0800_315b, 0x0800_3243, 0x0800_0195] + ); + + Ok(()) + } }