Use variable
This commit is contained in:
@@ -30,9 +30,13 @@ namespace Musify.Infrastructure.MassTransit.Activities.Files
|
||||
0,
|
||||
executeContext.CancellationToken);
|
||||
|
||||
var sourceFilePath = executeContext.GetVariable<string>(executeContext.Arguments.FilePathVariableName);
|
||||
if (string.IsNullOrEmpty(sourceFilePath))
|
||||
throw new InvalidOperationException($"Upload activity requires variable '{executeContext.Arguments.FilePathVariableName}' with source file path.");
|
||||
|
||||
try
|
||||
{
|
||||
using var fileStream = File.OpenRead(executeContext.Arguments.SourceFilePath);
|
||||
using var fileStream = File.OpenRead(sourceFilePath);
|
||||
|
||||
var uploadResult = await storageHandler.UploadFileAsync(
|
||||
fileStream,
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
namespace Musify.Infrastructure.MassTransit.Arguments
|
||||
{
|
||||
public record UploadFileToBucketArguments(
|
||||
string SourceFilePath,
|
||||
string FilePathVariableName,
|
||||
string ContentType,
|
||||
string DestinationBucketName,
|
||||
string DestinationKeyName);
|
||||
|
||||
Reference in New Issue
Block a user