mirror of
https://github.com/GopeedLab/gopeed.git
synced 2026-11-09 01:50:30 +00:00
fix: filename truncation for HTML-encoded ampersands in Content-Disposition (#1215)
This commit is contained in:
1 parent
6756d82ffa
commit
abd16d5326
4 files changed
+303
-5
No files matched your search
@@ -139,6 +139,30 @@ func TestFetcher_Resolve(t *testing.T) {
|
||||
},
|
||||
},
|
||||
}, t)
|
||||
// Test filename with HTML-encoded ampersand (fixes issue with & being truncated)
|
||||
// Before fix: "查询处理&优化.pptx" -> "查询处理&" (truncated at semicolon)
|
||||
// After fix: correctly decoded to "查询处理&优化.pptx"
|
||||
testResolve(test.StartTestCustomServer, "ampersand-encoded", &base.Resource{
|
||||
Size: test.BuildSize,
|
||||
Range: false,
|
||||
Files: []*base.FileInfo{
|
||||
{
|
||||
Name: "查询处理&优化.pptx",
|
||||
Size: test.BuildSize,
|
||||
},
|
||||
},
|
||||
}, t)
|
||||
// Test unquoted filename with HTML-encoded ampersand
|
||||
testResolve(test.StartTestCustomServer, "ampersand-unquoted", &base.Resource{
|
||||
Size: test.BuildSize,
|
||||
Range: false,
|
||||
Files: []*base.FileInfo{
|
||||
{
|
||||
Name: "test&file.txt",
|
||||
Size: test.BuildSize,
|
||||
},
|
||||
},
|
||||
}, t)
|
||||
|
||||
// Test URL without file path - should use domain/host as filename
|
||||
listener := test.StartTestRootServer()
|
||||
|
||||
Reference in new issue
Block a user