- Notifications
You must be signed in to change notification settings - Fork927
fix(cli): generate correctly named file in DumpHandler#12409
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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Uh oh!
There was an error while loading.Please reload this page.
Conversation
cli/root.go Outdated
@@ -992,7 +992,7 @@ func DumpHandler(ctx context.Context) { | |||
if err != nil { | |||
dir = os.TempDir() | |||
} | |||
fpath := filepath.Join(dir, fmt.Sprintf("coder-agent-%s.dump", time.Now().Format("2006-01-02T15:04:05.000Z"))) | |||
fpath := filepath.Join(dir, fmt.Sprintf("coder-%s-%s.dump", name, time.Now().Format("2006-01-02T15:04:05.000Z"))) |
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.
out of scope: we should probably not use colons in the file path as that's a forbidden character in NTFS.
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.
Good catch, it's such a small change I could piggy back it on this one.
Uh oh!
There was an error while loading.Please reload this page.
Noticed we always write the filenames with "agent" in the name, this fixes that.
EDIT: As a bonus we did
s/:/-/
on time so that files are safe on any filesystem, e.g. NTFS.EDIT2: As a bonus2 we use
time.Now().UTC()
since our formatting string appendsZ
to the filename, but we were actually rendering the local time.