Use variable

This commit is contained in:
2026-03-26 19:59:44 +01:00
parent 8431ed04c1
commit a3a09e45c3
2 changed files with 6 additions and 2 deletions
@@ -30,9 +30,13 @@ namespace Musify.Infrastructure.MassTransit.Activities.Files
0, 0,
executeContext.CancellationToken); 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 try
{ {
using var fileStream = File.OpenRead(executeContext.Arguments.SourceFilePath); using var fileStream = File.OpenRead(sourceFilePath);
var uploadResult = await storageHandler.UploadFileAsync( var uploadResult = await storageHandler.UploadFileAsync(
fileStream, fileStream,
@@ -1,7 +1,7 @@
namespace Musify.Infrastructure.MassTransit.Arguments namespace Musify.Infrastructure.MassTransit.Arguments
{ {
public record UploadFileToBucketArguments( public record UploadFileToBucketArguments(
string SourceFilePath, string FilePathVariableName,
string ContentType, string ContentType,
string DestinationBucketName, string DestinationBucketName,
string DestinationKeyName); string DestinationKeyName);