-
Notifications
You must be signed in to change notification settings - Fork 68
fix: [CI-19828] Throw error instead of warning in case of directory u… #200
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
| if count <= 1 { | ||
| log.Warnf("Skipping '%s' since it is a directory. Please use correct glob expression if this is unexpected.", source) | ||
| return fmt.Errorf("directory '%s' specified without glob pattern. Use a pattern like '%s/*' or '%s/**' to upload directory contents", source, source, source) | ||
| } | ||
| return true | ||
| } | ||
| return false | ||
| return nil | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When count > 1 (directory has glob-expanded children), the new code returns nil, and the caller will attempt to upload the directory itself. that will fail at os.Open or S3's PutObject. old code always skipped directories. we need to either:
- Return (skip bool, err error) so caller can continue for directories with children
- Or add a sentinel error like errSkipDirectory that the caller handles with continue
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Returned errSkip here so caller can continue for directories with children
… in os.Stat(source) and also handle the case of directory with blob pattern
Ompragash
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixes the bug, preserves original behavior, cross-platform tests, clean pattern so LGTM
…pload