fix for static

This commit is contained in:
Pavel 2023-11-12 23:44:57 +03:00
parent 2761dbb096
commit 3a2bc89fbd

View File

@ -54,9 +54,13 @@ func (c *Client) Open(user, path string) (fs.File, error) {
parts := strings.Split(strings.TrimLeft(path, "/"), "/") parts := strings.Split(strings.TrimLeft(path, "/"), "/")
log.Printf("parts: %d #%v", len(parts), parts) log.Printf("parts: %d #%v", len(parts), parts)
if len(parts) > 1 && !strings.Contains(parts[0], ".") { if len(parts) > 1 {
repo = parts[0] repo = parts[0]
filepath = strings.Join(parts[1:], "/") filepath = strings.Join(parts[1:], "/")
if strings.Contains(parts[len(parts)-1], ".") {
repo = fmt.Sprintf("%s.%s", user, c.domain)
filepath = path
}
} else { } else {
repo = fmt.Sprintf("%s.%s", user, c.domain) repo = fmt.Sprintf("%s.%s", user, c.domain)
filepath = path filepath = path