diff --git a/samples/openapi3/server/petstore/go/go-petstore/go/routers.go b/samples/openapi3/server/petstore/go/go-petstore/go/routers.go index 7dc2f17a0684..bb99aa60c82f 100644 --- a/samples/openapi3/server/petstore/go/go-petstore/go/routers.go +++ b/samples/openapi3/server/petstore/go/go-petstore/go/routers.go @@ -21,6 +21,7 @@ import ( "net/http" "net/url" "os" + "path/filepath" "strconv" "strings" ) @@ -74,7 +75,7 @@ func EncodeJSONResponse(i interface{}, status *int, headers map[string][]string, return err } wHeader.Set("Content-Type", http.DetectContentType(data)) - wHeader.Set("Content-Disposition", "attachment; filename="+f.Name()) + wHeader.Set("Content-Disposition", "attachment; filename="+filepath.Base(f.Name())) if status != nil { w.WriteHeader(*status) } else { diff --git a/samples/server/others/go-server/no-body-path-params/go/routers.go b/samples/server/others/go-server/no-body-path-params/go/routers.go index 392d00d7c0fa..ae67463577ce 100644 --- a/samples/server/others/go-server/no-body-path-params/go/routers.go +++ b/samples/server/others/go-server/no-body-path-params/go/routers.go @@ -20,6 +20,7 @@ import ( "net/http" "net/url" "os" + "path/filepath" "strconv" "strings" ) @@ -78,7 +79,7 @@ func EncodeJSONResponse(i interface{}, status *int, headers map[string][]string, return err } wHeader.Set("Content-Type", http.DetectContentType(data)) - wHeader.Set("Content-Disposition", "attachment; filename="+f.Name()) + wHeader.Set("Content-Disposition", "attachment; filename="+filepath.Base(f.Name())) if status != nil { w.WriteHeader(*status) } else { diff --git a/samples/server/petstore/go-api-server/go/routers.go b/samples/server/petstore/go-api-server/go/routers.go index 0418d5e575ee..3a4f2e5e1a35 100644 --- a/samples/server/petstore/go-api-server/go/routers.go +++ b/samples/server/petstore/go-api-server/go/routers.go @@ -20,6 +20,7 @@ import ( "net/http" "net/url" "os" + "path/filepath" "strconv" "strings" ) @@ -78,7 +79,7 @@ func EncodeJSONResponse(i interface{}, status *int, headers map[string][]string, return err } wHeader.Set("Content-Type", http.DetectContentType(data)) - wHeader.Set("Content-Disposition", "attachment; filename="+f.Name()) + wHeader.Set("Content-Disposition", "attachment; filename="+filepath.Base(f.Name())) if status != nil { w.WriteHeader(*status) } else { diff --git a/samples/server/petstore/go-chi-server/go/routers.go b/samples/server/petstore/go-chi-server/go/routers.go index 7dc2f17a0684..bb99aa60c82f 100644 --- a/samples/server/petstore/go-chi-server/go/routers.go +++ b/samples/server/petstore/go-chi-server/go/routers.go @@ -21,6 +21,7 @@ import ( "net/http" "net/url" "os" + "path/filepath" "strconv" "strings" ) @@ -74,7 +75,7 @@ func EncodeJSONResponse(i interface{}, status *int, headers map[string][]string, return err } wHeader.Set("Content-Type", http.DetectContentType(data)) - wHeader.Set("Content-Disposition", "attachment; filename="+f.Name()) + wHeader.Set("Content-Disposition", "attachment; filename="+filepath.Base(f.Name())) if status != nil { w.WriteHeader(*status) } else {