Skip to content

Commit dcbddb0

Browse files
authored
feat: serve any componentpack file (#4894)
1 parent b6d8e91 commit dcbddb0

File tree

2 files changed

+2
-12
lines changed

2 files changed

+2
-12
lines changed

apps/platform/pkg/cmd/serve.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -280,8 +280,7 @@ func serve(cmd *cobra.Command, args []string) error {
280280
sr.HandleFunc(routeByKey, controller.RouteByKey).Methods(http.MethodGet)
281281
wr.HandleFunc(routeByKey, controller.RouteByKey).Methods(http.MethodGet)
282282

283-
// NOTE: Gorilla Mux requires use of non-capturing groups, hence the use of ?: here
284-
componentPackFileSuffix := "/{filename:[a-zA-Z0-9\\-_]+\\.(?:json|js|xml|txt|css){1}(?:\\.map)?}"
283+
componentPackFileSuffix := "/{filename:.*}"
285284

286285
// Versioned component pack file routes
287286
versionedComponentPackPath := "/componentpacks/" + versionedItemParam

apps/platform/pkg/controller/file/componentpack.go

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ package file
33
import (
44
"bytes"
55
"net/http"
6-
"strings"
76
"time"
87

98
"github.com/gorilla/mux"
@@ -49,16 +48,8 @@ func ServeComponentPackFile(w http.ResponseWriter, r *http.Request) {
4948
lastModified = time.Unix(componentPack.UpdatedAt, 0)
5049
}
5150

52-
usePath := "pack.js"
53-
if path != "runtime.js" && strings.HasSuffix(path, ".json") {
54-
usePath = path
55-
}
56-
if path == "runtime.css" {
57-
usePath = path
58-
}
59-
6051
respondFile(w, r, &FileRequest{
61-
Path: usePath,
52+
Path: path,
6253
LastModified: lastModified,
6354
Namespace: namespace,
6455
Version: resourceVersion,

0 commit comments

Comments
 (0)