Skip to content

Commit 6e3e8a0

Browse files
committed
🐛 Don't crash if subbed page matches user dir pattern but doesn't have more
Fixes #157
1 parent b503471 commit 6e3e8a0

File tree

3 files changed

+8
-3
lines changed

3 files changed

+8
-3
lines changed

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,11 @@ All notable changes to this project will be documented in this file.
44
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
55
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
66

7+
## [1.7.2] - 2020-12-21
8+
### Fixed
9+
- Viewing subscriptions after subscribing to a certain user page won't crash Amfora (#157)
10+
11+
712
## [1.7.1] - 2020-12-21
813
### Fixed
914
- Fixed bug that caused Amfora to crash when subscribing to a page (#151)

amfora.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import (
1111
)
1212

1313
var (
14-
version = "v1.7.1"
14+
version = "v1.7.2"
1515
commit = "unknown"
1616
builtBy = "unknown"
1717
)

subscriptions/entries.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -112,14 +112,14 @@ func GetPageEntries() *PageEntries {
112112

113113
// Path is title
114114
title := parsed.Path
115-
if strings.HasPrefix(title, "/~") {
115+
if strings.HasPrefix(title, "/~") && title != "/~" {
116116
// A user dir
117117
title = title[2:] // Remove beginning slash and tilde
118118
// Remove trailing slash if the root of a user dir is being tracked
119119
if strings.Count(title, "/") <= 1 && title[len(title)-1] == '/' {
120120
title = title[:len(title)-1]
121121
}
122-
} else if strings.HasPrefix(title, "/users/") {
122+
} else if strings.HasPrefix(title, "/users/") && title != "/users/" {
123123
// "/users/" is removed for aesthetics when tracking hosted users
124124
title = strings.TrimPrefix(title, "/users/")
125125
title = strings.TrimPrefix(title, "~") // Remove leading tilde

0 commit comments

Comments
 (0)