Skip to content

Commit

Permalink
fix: improve error messages and file operations
Browse files Browse the repository at this point in the history
  • Loading branch information
pandatix committed Jun 1, 2024
1 parent 4ccad94 commit dc0b1f0
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ inputs:

runs:
using: 'docker'
image: 'docker://ctferio/ctfd-setup:v1.1.7'
image: 'docker://ctferio/ctfd-setup:v1.1.8'
env:
FILE: ${{ inputs.file }}
URL: ${{ inputs.url }}
Expand Down
8 changes: 4 additions & 4 deletions cmd/ctfd-setup/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -578,7 +578,7 @@ func run(ctx *cli.Context) error {

fd, err := os.Open(f)
if err != nil {
return errors.Wrapf(err, "opening file %s", f)
return errors.Wrapf(err, "opening configuration file %s", f)
}
defer fd.Close()

Expand Down Expand Up @@ -610,13 +610,13 @@ func intPtr(ctx *cli.Context, key string) *int {
}

func filePtr(ctx *cli.Context, key string) (*ctfdsetup.File, error) {
if !ctx.IsSet(key) {
fp := ctx.String(key)
if fp == "" {
return &ctfdsetup.File{}, nil
}
fp := ctx.String(key)
content, err := os.ReadFile(fp)
if err != nil {
return nil, err
return nil, errors.Wrapf(err, "failed to open file %s", fp)
}
return &ctfdsetup.File{
Name: filepath.Base(fp),
Expand Down

0 comments on commit dc0b1f0

Please sign in to comment.