repos / pico

pico services - prose.sh, pastes.sh, imgs.sh, feeds.sh, pgs.sh
git clone https://github.com/picosh/pico.git

pico / shared
Antonio Mika · 29 May 24

bucket.go

 1package shared
 2
 3import (
 4	"fmt"
 5	"os"
 6	"path/filepath"
 7	"strings"
 8
 9	"github.com/picosh/send/send/utils"
10)
11
12func GetImgsBucketName(userID string) string {
13	return userID
14}
15
16func GetAssetBucketName(userID string) string {
17	return fmt.Sprintf("static-%s", userID)
18}
19
20func GetProjectName(entry *utils.FileEntry) string {
21	if entry.Mode.IsDir() && strings.Count(entry.Filepath, string(os.PathSeparator)) == 0 {
22		return entry.Filepath
23	}
24
25	dir := filepath.Dir(entry.Filepath)
26	list := strings.Split(dir, string(os.PathSeparator))
27	return list[1]
28}
29
30func GetAssetFileName(entry *utils.FileEntry) string {
31	return entry.Filepath
32}