Skip to content

Commit ff2ae47

Browse files
committed
review comment work
1 parent 4c4df84 commit ff2ae47

File tree

2 files changed

+4
-6
lines changed

2 files changed

+4
-6
lines changed

internal/file/external_file_operator.go

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ func (efo *ExternalFileOperator) DownloadExternalFile(ctx context.Context, fileA
4343
) error {
4444
location := fileAction.File.GetExternalDataSource().GetLocation()
4545
permission := fileAction.File.GetFileMeta().GetPermissions()
46+
fileName := fileAction.File.GetFileMeta().GetName()
4647

4748
slog.InfoContext(ctx, "Downloading external file from", "location", location)
4849

@@ -54,29 +55,26 @@ func (efo *ExternalFileOperator) DownloadExternalFile(ctx context.Context, fileA
5455

5556
if downloadErr != nil {
5657
updateError = fmt.Errorf("failed to download file %s from %s: %w",
57-
fileAction.File.GetFileMeta().GetName(), location, downloadErr)
58+
fileName, location, downloadErr)
5859

5960
return updateError
6061
}
6162

6263
if contentToWrite == nil {
6364
slog.DebugContext(ctx, "External file unchanged (304), skipping disk write.",
64-
"file", fileAction.File.GetFileMeta().GetName())
65+
"file", fileName)
6566

6667
// preserve previous behavior: mark as unchanged so later rename is skipped
6768
fileAction.Action = model.Unchanged
6869

6970
// persist headers if present
7071
if headers.ETag != "" || headers.LastModified != "" {
71-
fileName := fileAction.File.GetFileMeta().GetName()
7272
efo.fileManagerService.externalFileHeaders[fileName] = headers
7373
}
7474

7575
return nil
7676
}
7777

78-
fileName := fileAction.File.GetFileMeta().GetName()
79-
8078
// Validate downloaded file type before writing to temp location.
8179
if err := efo.validateDownloadedFile(contentToWrite, fileName); err != nil {
8280
return fmt.Errorf("downloaded file validation failed for %s: %w", fileName, err)

internal/file/file_manager_service.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -254,7 +254,7 @@ func (fms *FileManagerService) Rollback(ctx context.Context, instanceID string)
254254

255255
continue
256256
case model.Delete, model.Update, model.ExternalFile:
257-
content, err := fms.restoreFiles(fileAction)
257+
content, err := fms.restoreFiles(ctx, fileAction)
258258
if err != nil {
259259
return err
260260
}

0 commit comments

Comments
 (0)