repos / pico

pico services mono repo
git clone https://github.com/picosh/pico.git

pico / pkg / shared
Eric Bower  ·  2026-03-02

bucket.go

 1package shared
 2
 3import (
 4	"fmt"
 5	"os"
 6	"path/filepath"
 7	"strings"
 8
 9	"github.com/picosh/pico/pkg/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	if len(list) == 0 {
28		return ""
29	} else if len(list) == 1 {
30		return list[0]
31	}
32	return list[1]
33}
34
35func GetAssetFileName(entry *utils.FileEntry) string {
36	return entry.Filepath
37}