Skip to content

Commit

Permalink
🐛 Don't crash if subbed page matches user dir pattern but doesn't hav…
Browse files Browse the repository at this point in the history
…e more

Fixes #157
  • Loading branch information
makew0rld committed Dec 24, 2020
1 parent b503471 commit 6e3e8a0
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 3 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion amfora.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import (
)

var (
version = "v1.7.1"
version = "v1.7.2"
commit = "unknown"
builtBy = "unknown"
)
Expand Down
4 changes: 2 additions & 2 deletions subscriptions/entries.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 6e3e8a0

Please sign in to comment.