fix: 修复assets文件路径拼接错误
- Gin的*filepath参数包含开头的/,需要去除 - 修复路径拼接导致的双斜杠问题 - 移除自动刷新逻辑,这不是正确的解决方案
This commit is contained in:
@@ -264,6 +264,7 @@ func setupEmbeddedFrontend(r *gin.Engine) {
|
|||||||
|
|
||||||
r.GET("/assets/*filepath", func(c *gin.Context) {
|
r.GET("/assets/*filepath", func(c *gin.Context) {
|
||||||
filepath := c.Param("filepath")
|
filepath := c.Param("filepath")
|
||||||
|
filepath = strings.TrimPrefix(filepath, "/")
|
||||||
decodedPath, err := url.PathUnescape(filepath)
|
decodedPath, err := url.PathUnescape(filepath)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
decodedPath = filepath
|
decodedPath = filepath
|
||||||
|
|||||||
@@ -13,12 +13,6 @@ const router = createRouter({
|
|||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
|
||||||
router.onError((error) => {
|
|
||||||
if (error.message.includes('Failed to fetch dynamically imported module')) {
|
|
||||||
window.location.reload()
|
|
||||||
}
|
|
||||||
})
|
|
||||||
|
|
||||||
createRouterGuard(router)
|
createRouterGuard(router)
|
||||||
|
|
||||||
export default router
|
export default router
|
||||||
|
|||||||
Reference in New Issue
Block a user