mirror of https://github.com/harness/drone.git
Fix 404 on refreshing routes that has ... in it (#628)
parent
812d1f6aea
commit
93845bc66b
|
@ -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 = "/"
|
||||||
|
|
Loading…
Reference in New Issue