fix: TusUploadExists needs to operate on TusUpload not Upload
This commit is contained in:
parent
e8fbe46dfc
commit
8c86ecc5b7
|
@ -18,7 +18,7 @@ type StorageService interface {
|
||||||
GetHashSmall(file io.ReadSeeker) ([]byte, error)
|
GetHashSmall(file io.ReadSeeker) ([]byte, error)
|
||||||
GetHash(file io.Reader) ([]byte, error)
|
GetHash(file io.Reader) ([]byte, error)
|
||||||
CreateUpload(hash []byte, uploaderID uint, uploaderIP string, size uint64, protocol string) (*models.Upload, error)
|
CreateUpload(hash []byte, uploaderID uint, uploaderIP string, size uint64, protocol string) (*models.Upload, error)
|
||||||
TusUploadExists(hash []byte) (bool, models.Upload)
|
TusUploadExists(hash []byte) (bool, models.TusUpload)
|
||||||
CreateTusUpload(hash []byte, uploadID string, uploaderID uint, uploaderIP string, protocol string) (*models.TusUpload, error)
|
CreateTusUpload(hash []byte, uploadID string, uploaderID uint, uploaderIP string, protocol string) (*models.TusUpload, error)
|
||||||
TusUploadProgress(uploadID string) error
|
TusUploadProgress(uploadID string) error
|
||||||
DeleteTusUpload(uploadID string) error
|
DeleteTusUpload(uploadID string) error
|
||||||
|
|
|
@ -374,11 +374,11 @@ func (s *StorageServiceImpl) tusWorker() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *StorageServiceImpl) TusUploadExists(hash []byte) (bool, models.Upload) {
|
func (s *StorageServiceImpl) TusUploadExists(hash []byte) (bool, models.TusUpload) {
|
||||||
hashStr := hex.EncodeToString(hash)
|
hashStr := hex.EncodeToString(hash)
|
||||||
|
|
||||||
var upload models.Upload
|
var upload models.TusUpload
|
||||||
result := s.portal.Database().Model(&models.Upload{}).Where(&models.Upload{Hash: hashStr}).First(&upload)
|
result := s.portal.Database().Model(&models.TusUpload{}).Where(&models.TusUpload{Hash: hashStr}).First(&upload)
|
||||||
|
|
||||||
return result.RowsAffected > 0, upload
|
return result.RowsAffected > 0, upload
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue