Skip to content
This repository was archived by the owner on Sep 23, 2021. It is now read-only.

Commit 0a5d793

Browse files
committed
Add Path function
1 parent d844211 commit 0a5d793

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

main.go

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,10 @@ func authorizationHeader(user, password string) string {
6363
return "Basic " + base64.StdEncoding.EncodeToString([]byte(base))
6464
}
6565

66+
func SlidePath(name string) string {
67+
return fmt.Sprintf("slides/%s.md", name)
68+
}
69+
6670
func NewApp() *gin.Engine {
6771

6872
r := gin.Default()
@@ -90,7 +94,7 @@ func NewApp() *gin.Engine {
9094
} else {
9195
name = strings.Replace(latest, ".md", "", 1)
9296
}
93-
path = fmt.Sprintf("slides/%s.md", name)
97+
path = SlidePath(name)
9498

9599
log.WithFields(log.Fields{
96100
"path": path,
@@ -185,7 +189,7 @@ func NewApp() *gin.Engine {
185189
if strings.HasSuffix(name, ".md") {
186190
name = name[0 : len(name)-3]
187191
}
188-
path := fmt.Sprintf("slides/%s.md", name)
192+
path := SlidePath(name)
189193
session := sessions.Default(c)
190194
session.Set("name", path)
191195
session.Save()
@@ -205,7 +209,7 @@ func NewApp() *gin.Engine {
205209
if strings.HasSuffix(name, ".md") {
206210
name = name[0 : len(name)-3]
207211
}
208-
path := fmt.Sprintf("slides/%s.md", name)
212+
path := SlidePath(name)
209213
session := sessions.Default(c)
210214
session.Set("name", path)
211215
session.Save()

0 commit comments

Comments
 (0)