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
This commit is contained in:
Gareth Simpson 2023-01-24 05:37:15 +00:00 committed by GitHub
parent a7c7dfd24e
commit d0854d0107
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -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 }) {