Skip to content

Commit ac04696

Browse files
committed
Possible Windows fix: usee full dir name
1 parent f12ab8d commit ac04696

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

internal/pipeline/cleanup.go

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -234,13 +234,21 @@ func (cs *CleanupService) shouldDeleteDirectory(ctx context.Context, dirName str
234234
))
235235
defer span.End()
236236

237+
// Extract just the directory name in case we got a full path
238+
// This is important for Windows compatibility where dirName might be a full path
239+
baseName := filepath.Base(dirName)
240+
237241
// Parse timestamp from directory name
238242
// Format: <shard-name>-YYYYMMDD-HHMMSS
239-
timestampStr := dirName[len(cs.shard.Name)+1:] // Skip shard name and hyphen
243+
if len(baseName) <= len(cs.shard.Name)+1 {
244+
return false, fmt.Errorf("directory name too short: %s", baseName)
245+
}
246+
247+
timestampStr := baseName[len(cs.shard.Name)+1:] // Skip shard name and hyphen
240248
dirTime, err := time.Parse("20060102-150405", timestampStr)
241249
if err != nil {
242250
span.RecordError(err)
243-
return false, fmt.Errorf("failed to parse directory timestamp: %w", err)
251+
return false, fmt.Errorf("failed to parse directory timestamp from %s: %w", baseName, err)
244252
}
245253

246254
// Check if directory is old enough

0 commit comments

Comments
 (0)