You've already forked pocketbase
mirror of
https://github.com/pocketbase/pocketbase.git
synced 2025-11-27 00:20:27 +02:00
store the original uploaded file name as metadata
This commit is contained in:
@@ -162,14 +162,24 @@ func TestFileSystemUploadMultipart(t *testing.T) {
|
||||
}
|
||||
defer fs.Close()
|
||||
|
||||
uploadErr := fs.UploadMultipart(fh, "newdir/newkey.txt")
|
||||
fileKey := "newdir/newkey.txt"
|
||||
|
||||
uploadErr := fs.UploadMultipart(fh, fileKey)
|
||||
if uploadErr != nil {
|
||||
t.Fatal(uploadErr)
|
||||
}
|
||||
|
||||
if exists, _ := fs.Exists("newdir/newkey.txt"); !exists {
|
||||
if exists, _ := fs.Exists(fileKey); !exists {
|
||||
t.Fatalf("Expected newdir/newkey.txt to exist")
|
||||
}
|
||||
|
||||
attrs, err := fs.Attributes(fileKey)
|
||||
if err != nil {
|
||||
t.Fatalf("Failed to fetch file attributes: %v", err)
|
||||
}
|
||||
if name, ok := attrs.Metadata["original_filename"]; !ok || name != "test" {
|
||||
t.Fatalf("Expected original_filename to be %q, got %q", "test", name)
|
||||
}
|
||||
}
|
||||
|
||||
func TestFileSystemUpload(t *testing.T) {
|
||||
|
||||
Reference in New Issue
Block a user