From 6e3e8a0584c006d2b4f082387c2361f3a6b0645f Mon Sep 17 00:00:00 2001 From: makeworld Date: Wed, 23 Dec 2020 23:57:18 -0500 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9B=20Don't=20crash=20if=20subbed=20pa?= =?UTF-8?q?ge=20matches=20user=20dir=20pattern=20but=20doesn't=20have=20mo?= =?UTF-8?q?re?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fixes #157 --- CHANGELOG.md | 5 +++++ amfora.go | 2 +- subscriptions/entries.go | 4 ++-- 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 1165507f..c42a01ad 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,11 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## [1.7.2] - 2020-12-21 +### Fixed +- Viewing subscriptions after subscribing to a certain user page won't crash Amfora (#157) + + ## [1.7.1] - 2020-12-21 ### Fixed - Fixed bug that caused Amfora to crash when subscribing to a page (#151) diff --git a/amfora.go b/amfora.go index 6e5b80b5..09bbbc5f 100644 --- a/amfora.go +++ b/amfora.go @@ -11,7 +11,7 @@ import ( ) var ( - version = "v1.7.1" + version = "v1.7.2" commit = "unknown" builtBy = "unknown" ) diff --git a/subscriptions/entries.go b/subscriptions/entries.go index 5e45f10b..5281af59 100644 --- a/subscriptions/entries.go +++ b/subscriptions/entries.go @@ -112,14 +112,14 @@ func GetPageEntries() *PageEntries { // Path is title title := parsed.Path - if strings.HasPrefix(title, "/~") { + if strings.HasPrefix(title, "/~") && title != "/~" { // A user dir title = title[2:] // Remove beginning slash and tilde // Remove trailing slash if the root of a user dir is being tracked if strings.Count(title, "/") <= 1 && title[len(title)-1] == '/' { title = title[:len(title)-1] } - } else if strings.HasPrefix(title, "/users/") { + } else if strings.HasPrefix(title, "/users/") && title != "/users/" { // "/users/" is removed for aesthetics when tracking hosted users title = strings.TrimPrefix(title, "/users/") title = strings.TrimPrefix(title, "~") // Remove leading tilde