Fix 404 on refreshing routes that has ... in it (#628)

pull/3393/head
Tan Nhu 2023-09-28 23:58:38 +00:00 committed by Harness
parent 812d1f6aea
commit 93845bc66b
1 changed files with 2 additions and 1 deletions

View File

@ -27,6 +27,7 @@ import (
"os" "os"
"path" "path"
"path/filepath" "path/filepath"
"strings"
"time" "time"
"github.com/rs/zerolog/log" "github.com/rs/zerolog/log"
@ -55,7 +56,7 @@ func Handler() http.HandlerFunc {
// we need to always load the index.html file // we need to always load the index.html file
// in the root of the project, unless the path // in the root of the project, unless the path
// points to a file with an extension (css, js, etc) // points to a file with an extension (css, js, etc)
if filepath.Ext(r.URL.Path) == "" { if filepath.Ext(r.URL.Path) == "" || strings.Contains(r.URL.Path, "...") {
// HACK: alter the path to point to the // HACK: alter the path to point to the
// root of the project. // root of the project.
r.URL.Path = "/" r.URL.Path = "/"