mirror of
https://github.com/aykhans/slash-e.git
synced 2026-11-10 15:41:09 +00:00
chore: add location header
This commit is contained in:
1 parent
80548aaf2c
commit
a3943f5b2d
3 files changed
+42
-1
No files matched your search
@@ -92,9 +92,13 @@ func (s *FrontendService) registerRoutes(e *echo.Echo) {
|
||||
}
|
||||
|
||||
metric.Enqueue("shortcut view")
|
||||
// Only set the `Location` header if the link is a valid URI.
|
||||
if util.ValidateURI(shortcut.Link) {
|
||||
c.Response().Header().Set("Location", shortcut.Link)
|
||||
}
|
||||
// Inject shortcut metadata into `index.html`.
|
||||
indexHTML := strings.ReplaceAll(rawIndexHTML, headerMetadataPlaceholder, generateShortcutMetadata(shortcut).String())
|
||||
return c.HTML(http.StatusOK, indexHTML)
|
||||
return c.HTML(http.StatusSeeOther, indexHTML)
|
||||
})
|
||||
|
||||
e.GET("/c/:collectionName", func(c echo.Context) error {
|
||||
|
||||
Reference in new issue
Block a user