diff --git a/backend/cmd/main.go b/backend/cmd/main.go index be759b1..7ad373c 100644 --- a/backend/cmd/main.go +++ b/backend/cmd/main.go @@ -6,6 +6,7 @@ import ( "io/fs" "log" "net/http" + "net/url" "os" "strings" "verification-platform-backend/internal/config" @@ -263,8 +264,12 @@ func setupEmbeddedFrontend(r *gin.Engine) { r.GET("/assets/*filepath", func(c *gin.Context) { filepath := c.Param("filepath") + decodedPath, err := url.PathUnescape(filepath) + if err != nil { + decodedPath = filepath + } c.Header("Cache-Control", "public, max-age=31536000, immutable") - c.FileFromFS("assets/"+filepath, http.FS(distFS)) + c.FileFromFS("assets/"+decodedPath, http.FS(distFS)) }) r.NoRoute(func(c *gin.Context) { @@ -274,7 +279,11 @@ func setupEmbeddedFrontend(r *gin.Engine) { } path := strings.TrimPrefix(c.Request.URL.Path, "/") - if f, err := distFS.Open(path); err == nil { + decodedPath, err := url.PathUnescape(path) + if err != nil { + decodedPath = path + } + if f, err := distFS.Open(decodedPath); err == nil { f.Close() c.FileFromFS(c.Request.URL.Path, http.FS(distFS)) return diff --git a/frontend/vite.config.ts b/frontend/vite.config.ts index cbff1c5..3475710 100644 --- a/frontend/vite.config.ts +++ b/frontend/vite.config.ts @@ -103,6 +103,15 @@ export default defineConfig({ '@': fileURLToPath(new URL('./src', import.meta.url)), }, }, + build: { + rollupOptions: { + output: { + chunkFileNames: 'assets/[name]-[hash].js', + entryFileNames: 'assets/[name]-[hash].js', + assetFileNames: 'assets/[name]-[hash].[ext]', + }, + }, + }, server: { proxy: { '/api': {