feat: add file deduplication and hash checking for uploads
- Implemented SHA-256 hashing for uploaded files to enable deduplication. - Added CheckHash method to verify if a file with the same hash already exists. - Updated Upload method to reuse existing media assets if a duplicate is found. - Introduced a new hash column in the media_assets table to store file hashes. - Enhanced the upload process to include progress tracking and hash calculation. - Modified frontend to check for existing files before uploading and to show upload progress. - Added vuedraggable for drag-and-drop functionality in the content editing view.
This commit is contained in:
@@ -14,27 +14,27 @@ func TestStorageProvider(t *testing.T) {
|
||||
// Mock Config to match what we expect in config.toml
|
||||
// We use a map to simulate how unmarshal might see it, or just use the Config struct directly if we can manual init.
|
||||
// But provider uses UnmarshalConfig.
|
||||
|
||||
|
||||
// To test properly, we should try to boot the provider or check the logic.
|
||||
// Let's manually init the Storage struct with the config we expect to be loaded.
|
||||
|
||||
|
||||
cfg := &storage.Config{
|
||||
Type: "local",
|
||||
LocalPath: "./storage",
|
||||
Secret: "your-storage-secret",
|
||||
BaseURL: "http://localhost:8080/v1/storage",
|
||||
}
|
||||
|
||||
|
||||
s := &storage.Storage{Config: cfg}
|
||||
|
||||
|
||||
Convey("SignURL should return absolute URL with BaseURL", func() {
|
||||
key := "test.png"
|
||||
url, err := s.SignURL("GET", key, 1*time.Hour)
|
||||
So(err, ShouldBeNil)
|
||||
|
||||
|
||||
// Log for debugging
|
||||
t.Logf("Generated URL: %s", url)
|
||||
|
||||
|
||||
So(url, ShouldStartWith, "http://localhost:8080/v1/storage/test.png")
|
||||
So(url, ShouldContainSubstring, "sign=")
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user