From d0854d01075f15693e1d205b87871f076c25b8ef Mon Sep 17 00:00:00 2001 From: Gareth Simpson Date: Tue, 24 Jan 2023 05:37:15 +0000 Subject: [PATCH] This is a fix for #317 (#318) * This is a fix for #317 Well more of an improvement than a fix. Instead of looking for tags anywhere, we now look for /tags/TagName exactly. This can still fail if it happens to be a link to somewhere not on the post creator's home server that follows that pattern but by the time the parsing is done the post creator isn't available without a lot of re-plumbing. But anyway, this should be better. * No force unwrap --- Packages/Env/Sources/Env/Router.swift | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Packages/Env/Sources/Env/Router.swift b/Packages/Env/Sources/Env/Router.swift index 6e98e144..b1c1cbed 100644 --- a/Packages/Env/Sources/Env/Router.swift +++ b/Packages/Env/Sources/Env/Router.swift @@ -62,9 +62,10 @@ public class RouterPath: ObservableObject { } public func handleStatus(status: AnyStatus, url: URL) -> OpenURLAction.Result { - if url.pathComponents.contains(where: { $0 == "tags" }), + if url.pathComponents.count == 3 && url.pathComponents[1] == "tags", let tag = url.pathComponents.last { + navigate(to: .hashTag(tag: tag, account: nil)) return .handled } else if let mention = status.mentions.first(where: { $0.url == url }) {