Initial commit: Open sourcing all of the Maple Open Technologies code.
This commit is contained in:
commit
755d54a99d
2010 changed files with 448675 additions and 0 deletions
|
|
@ -0,0 +1,29 @@
|
|||
// monorepo/cloud/backend/internal/maplefile/repo/fileobjectstorage/upload.go
|
||||
package fileobjectstorage
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
|
||||
"go.uber.org/zap"
|
||||
)
|
||||
|
||||
// StoreEncryptedData uploads encrypted file data to S3 and returns the storage path
|
||||
func (impl *fileObjectStorageRepositoryImpl) StoreEncryptedData(ownerID string, fileID string, encryptedData []byte) (string, error) {
|
||||
ctx := context.Background()
|
||||
|
||||
// Generate a storage path using a deterministic pattern
|
||||
storagePath := fmt.Sprintf("users/%s/files/%s", ownerID, fileID)
|
||||
|
||||
// Always store encrypted data as private
|
||||
err := impl.Storage.UploadContentWithVisibility(ctx, storagePath, encryptedData, false)
|
||||
if err != nil {
|
||||
impl.Logger.Error("Failed to store encrypted data",
|
||||
zap.String("fileID", fileID),
|
||||
zap.String("ownerID", ownerID),
|
||||
zap.Error(err))
|
||||
return "", err
|
||||
}
|
||||
|
||||
return storagePath, nil
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue