Projects STRLCPY reverse_ssh Commits 4bc62eea
🤬
  • Allow slashes in webserver generated names

  • Loading...
  • NHAS committed 1 year ago
    4bc62eea
    1 parent a13d09e0
Revision indexing in progress... (symbol navigation in revisions will be accurate after indexed)
  • ■ ■ ■ ■ ■
    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
Please wait...
Page is in error, reload to recover