Timelines: fix hashtag timelines
authorMikael Berthe <mikael@lilotux.net>
Wed, 12 Apr 2017 23:36:46 +0200
changeset 94 beee0238a82e
parent 93 d427d8aa75f9
child 95 94f139efff39
Timelines: fix hashtag timelines
timelines.go
--- a/timelines.go	Wed Apr 12 23:22:42 2017 +0200
+++ b/timelines.go	Wed Apr 12 23:36:46 2017 +0200
@@ -17,7 +17,11 @@
 	if timeline == "home" || timeline == "public" {
 		endPoint = "timelines/" + timeline
 	} else if strings.HasPrefix(timeline, ":") {
-		endPoint = "timelines/tag/" + timeline
+		hashtag := timeline[1:]
+		if hashtag == "" {
+			return tl, fmt.Errorf("timelines API: empty hashtag")
+		}
+		endPoint = "timelines/tag/" + hashtag
 	} else {
 		return tl, fmt.Errorf("GetTimelines: bad timelines argument")
 	}