From 8c86ecc5b7313f3d52693704fc9f8aaaee5de4e6 Mon Sep 17 00:00:00 2001 From: Derrick Hammer Date: Sat, 20 Jan 2024 07:05:27 -0500 Subject: [PATCH] fix: TusUploadExists needs to operate on TusUpload not Upload --- interfaces/storage.go | 2 +- storage/storage.go | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/interfaces/storage.go b/interfaces/storage.go index 990d0cc..c22fb1b 100644 --- a/interfaces/storage.go +++ b/interfaces/storage.go @@ -18,7 +18,7 @@ type StorageService interface { GetHashSmall(file io.ReadSeeker) ([]byte, error) GetHash(file io.Reader) ([]byte, 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) TusUploadProgress(uploadID string) error DeleteTusUpload(uploadID string) error diff --git a/storage/storage.go b/storage/storage.go index 1426bce..529e0f1 100644 --- a/storage/storage.go +++ b/storage/storage.go @@ -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) - var upload models.Upload - result := s.portal.Database().Model(&models.Upload{}).Where(&models.Upload{Hash: hashStr}).First(&upload) + var upload models.TusUpload + result := s.portal.Database().Model(&models.TusUpload{}).Where(&models.TusUpload{Hash: hashStr}).First(&upload) return result.RowsAffected > 0, upload }