| 352 | } |
| 353 | |
| 354 | func (d *Crypt) Put(ctx context.Context, dstDir model.Obj, streamer model.FileStreamer, up driver.UpdateProgress) error { |
| 355 | remoteStorage, remoteActualPath, err := op.GetStorageAndActualPath(dstDir.GetPath()) |
| 356 | if err != nil { |
| 357 | return err |
| 358 | } |
| 359 | |
| 360 | // Encrypt the data into wrappedIn |
| 361 | wrappedIn, err := d.cipher.EncryptData(streamer) |
| 362 | if err != nil { |
| 363 | return fmt.Errorf("failed to EncryptData: %w", err) |
| 364 | } |
| 365 | |
| 366 | // doesn't support seekableStream, since rapid-upload is not working for encrypted data |
| 367 | streamOut := &stream.FileStream{ |
| 368 | Obj: &model.Object{ |
| 369 | ID: streamer.GetID(), |
| 370 | Path: streamer.GetPath(), |
| 371 | Name: d.cipher.EncryptFileName(streamer.GetName()), |
| 372 | Size: d.cipher.EncryptedSize(streamer.GetSize()), |
| 373 | Modified: streamer.ModTime(), |
| 374 | IsFolder: streamer.IsDir(), |
| 375 | }, |
| 376 | Reader: wrappedIn, |
| 377 | Mimetype: "application/octet-stream", |
| 378 | ForceStreamUpload: true, |
| 379 | Exist: streamer.GetExist(), |
| 380 | } |
| 381 | return op.Put(ctx, remoteStorage, remoteActualPath, streamOut, up) |
| 382 | } |
| 383 | |
| 384 | func (d *Crypt) GetDetails(ctx context.Context) (*model.StorageDetails, error) { |
| 385 | remoteStorage, _, err := op.GetStorageAndActualPath(d.RemotePath) |