mirror of https://github.com/perkeep/perkeep.git
factored syntax for block of regexps
Change-Id: Ie0f2e343fa9a37be8fd32356a72c26ccf46af311
This commit is contained in:
parent
420dccdd10
commit
de535fa264
|
@ -35,19 +35,21 @@ import (
|
|||
|
||||
var _ = log.Printf
|
||||
|
||||
var staticFilePattern = regexp.MustCompile(`^([a-zA-Z0-9\-\_]+\.(html|js|css|png|jpg|gif))$`)
|
||||
var identPattern = regexp.MustCompile(`^[a-zA-Z\_]+$`)
|
||||
var (
|
||||
staticFilePattern = regexp.MustCompile(`^([a-zA-Z0-9\-\_]+\.(html|js|css|png|jpg|gif))$`)
|
||||
identPattern = regexp.MustCompile(`^[a-zA-Z\_]+$`)
|
||||
|
||||
// Download URL suffix:
|
||||
// $1: blobref (checked in download handler)
|
||||
// $2: optional "/filename" to be sent as recommended download name,
|
||||
// if sane looking
|
||||
downloadPattern = regexp.MustCompile(`^download/([^/]+)(/.*)?$`)
|
||||
thumbnailPattern = regexp.MustCompile(`^thumbnail/([^/]+)(/.*)?$`)
|
||||
treePattern = regexp.MustCompile(`^tree/([^/]+)(/.*)?$`)
|
||||
)
|
||||
|
||||
var uiFiles = uistatic.Files
|
||||
|
||||
// Download URL suffix:
|
||||
// $1: blobref (checked in download handler)
|
||||
// $2: optional "/filename" to be sent as recommended download name,
|
||||
// if sane looking
|
||||
var downloadPattern = regexp.MustCompile(`^download/([^/]+)(/.*)?$`)
|
||||
var thumbnailPattern = regexp.MustCompile(`^thumbnail/([^/]+)(/.*)?$`)
|
||||
var treePattern = regexp.MustCompile(`^tree/([^/]+)(/.*)?$`)
|
||||
|
||||
// UIHandler handles serving the UI and discovery JSON.
|
||||
type UIHandler struct {
|
||||
// URL prefixes (path or full URL) to the primary blob and
|
||||
|
|
Loading…
Reference in New Issue