refactor file upload process to use MD5 instead of SHA-1 for hash calculation and update related API and model structures

This commit is contained in:
nyne
2025-05-16 16:55:45 +08:00
parent 313e696248
commit 7bfd33c714
7 changed files with 61 additions and 139 deletions

View File

@@ -21,7 +21,7 @@ type UploadingFile struct {
TempPath string
Resource Resource `gorm:"foreignKey:TargetResourceID"`
Storage Storage `gorm:"foreignKey:TargetStorageID"`
Sha1 string
Md5 string
}
func (uf *UploadingFile) BlocksCount() int {
@@ -86,7 +86,7 @@ type UploadingFileView struct {
BlocksCount int `json:"blocksCount"`
StorageID uint `json:"storageId"`
ResourceID uint `json:"resourceId"`
Sha1 string `json:"sha1"`
Md5 string `json:"md5"`
}
func (uf *UploadingFile) ToView() *UploadingFileView {
@@ -99,6 +99,6 @@ func (uf *UploadingFile) ToView() *UploadingFileView {
BlocksCount: uf.BlocksCount(),
StorageID: uf.TargetStorageID,
ResourceID: uf.TargetResourceID,
Sha1: uf.Sha1,
Md5: uf.Md5,
}
}