mirror of
https://github.com/seaweedfs/seaweedfs.git
synced 2026-11-05 11:37:44 +01:00
Fix UI prefix url encoding (#9344)
* Fix filer UI navigation for URL-sensitive object prefixes * Fix filer UI navigation for URL-sensitive object prefixes * Clarify filer UI path escaping test name Rename the legacy filer UI path test to describe the actual behavior being checked. The printpath helper preserves timestamp characters that are valid in URL path components, while the PR fix is focused on query-string escaping for path and cursor parameters.
This commit is contained in:
1 parent
487b93eb49
commit
a1e5eb9dad
7 files changed
+77
-19
No files matched your search
@@ -84,3 +84,21 @@ func TestToBreadcrumb(t *testing.T) {
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
func TestPrintPathPreservesPathSafeTimestampChars(t *testing.T) {
|
||||
got := printpath("/logs/run_id=backfill__2025-01-31T15:00:00+00:00/")
|
||||
want := "/logs/run_id=backfill__2025-01-31T15:00:00+00:00/"
|
||||
|
||||
if got != want {
|
||||
t.Fatalf("printpath() = %q, want %q", got, want)
|
||||
}
|
||||
}
|
||||
|
||||
func TestQueryEscapePreservesPlusInLoadMoreCursor(t *testing.T) {
|
||||
got := funcMap["queryEscape"].(func(string) string)("task:1+next")
|
||||
want := "task%3A1%2Bnext"
|
||||
|
||||
if got != want {
|
||||
t.Fatalf("queryEscape() = %q, want %q", got, want)
|
||||
}
|
||||
}
|
||||
@@ -170,7 +170,7 @@
|
||||
|
||||
{{ if .ShouldDisplayLoadMore }}
|
||||
<div class="row">
|
||||
<a href={{ print .Path "?limit=" .Limit "&lastFileName=" .LastFileName }} >
|
||||
<a href="{{ printpath .Path }}?limit={{ .Limit }}&lastFileName={{ queryEscape .LastFileName }}" >
|
||||
Load more
|
||||
</a>
|
||||
</div>
|
||||
|
||||
@@ -18,6 +18,7 @@ func printpath(parts ...string) string {
|
||||
var funcMap = template.FuncMap{
|
||||
"humanizeBytes": humanize.Bytes,
|
||||
"printpath": printpath,
|
||||
"queryEscape": url.QueryEscape,
|
||||
}
|
||||
|
||||
//go:embed filer.html
|
||||
|
||||
Reference in new issue
Block a user