all repos — website @ d2085746f3301d770230e7b52986db6994d5e35c

My website

internal/storage/sqlite/file.go (view raw)

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
package sqlite

import (
	"strings"
)

func pathNameToFileName(pathname string) string {
	if strings.HasSuffix(pathname, "/") {
		pathname = pathname + "index.html"
	}

	return pathname
}

func fileNameToPathName(filename string) string {
	pathname := strings.TrimSuffix(filename, "index.html")
	pathname = strings.TrimPrefix(pathname, "/")

	return "/" + pathname
}