■ ■ ■ ■ ■ ■
internal/server/webserver/webserver.go
| skipped 46 lines |
47 | 47 | | |
48 | 48 | | func buildAndServe(project, connectBackAddress string, validPlatforms, validArchs map[string]bool) http.HandlerFunc { |
49 | 49 | | return func(w http.ResponseWriter, req *http.Request) { |
50 | | - | parts := strings.Split(req.URL.Path[1:], "/") |
51 | 50 | | |
52 | 51 | | log.Printf("[%s] INFO Web Server got hit: %s\n", req.RemoteAddr, req.URL.Path) |
53 | | - | if len(parts) == 0 { // This should never happen |
54 | | - | http.Error(w, "Error", 501) |
55 | | - | return |
56 | | - | } |
57 | 52 | | |
58 | | - | filename := filepath.Base(req.URL.Path) |
| 53 | + | filename := strings.TrimPrefix(req.URL.Path, "/") |
59 | 54 | | linkExtension := filepath.Ext(filename) |
60 | 55 | | |
61 | 56 | | filenameWithoutExtension := strings.TrimSuffix(filename, linkExtension) |
| skipped 82 lines |