fix: 修复文件预览重定向与扩展名解析
This commit is contained in:
@@ -0,0 +1,26 @@
|
||||
//go:build mysql
|
||||
// +build mysql
|
||||
|
||||
package mysql
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/tinode/chat/server/store/types"
|
||||
)
|
||||
|
||||
func TestParseFileUIDStripsPublicExtension(t *testing.T) {
|
||||
uid := types.ParseUid("scH0N8guCHk")
|
||||
if uid.IsZero() {
|
||||
t.Fatal("test UID failed to parse")
|
||||
}
|
||||
if got := parseFileUID("scH0N8guCHk.bin"); got != uid {
|
||||
t.Fatalf("parseFileUID()=%q, want %q", got.String(), uid.String())
|
||||
}
|
||||
if got := parseFileUID("scH0N8guCHk.jpg"); got != uid {
|
||||
t.Fatalf("parseFileUID()=%q, want %q", got.String(), uid.String())
|
||||
}
|
||||
if got := parseFileUID("scH0N8guCHk"); got != uid {
|
||||
t.Fatalf("parseFileUID()=%q, want %q", got.String(), uid.String())
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user