diff options
author | Christian Pointner <equinox@helsinki.at> | 2016-03-11 16:39:12 (GMT) |
---|---|---|
committer | Christian Pointner <equinox@helsinki.at> | 2016-03-11 16:39:12 (GMT) |
commit | e22e19a7ab173a43376ff19da9eaf6d50032c915 (patch) | |
tree | 0f3cb7f4d0c40cad6d039ed2dc4960649122758b /rhimport/importer.go | |
parent | 78d356b26f82e7d1c26111d07024778ae2055e1c (diff) |
introduced SourceFilePolicy
Diffstat (limited to 'rhimport/importer.go')
-rw-r--r-- | rhimport/importer.go | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/rhimport/importer.go b/rhimport/importer.go index 6d994c3..c840bae 100644 --- a/rhimport/importer.go +++ b/rhimport/importer.go @@ -410,7 +410,7 @@ func addShowCartCut(ctx *Context, res *Result, carts []uint) (err error) { return } -func cleanupFiles(ctx *Context) { +func cleanupFiles(ctx *Context, res *Result) { if ctx.DeleteSourceFile { rhdl.Printf("importer: removing file: %s", ctx.SourceFile) if err := os.Remove(ctx.SourceFile); err != nil { @@ -424,12 +424,15 @@ func cleanupFiles(ctx *Context) { rhl.Printf("importer: error removing source directory: %s", err) } } + } else { + res.SourceFile = ctx.SourceFile } return } func ImportFile(ctx *Context) (res *Result, err error) { - defer cleanupFiles(ctx) + res = &Result{ResponseCode: http.StatusOK} + defer cleanupFiles(ctx, res) rhl.Printf("importer: ImportFile called with: show-id: %d, pool-name: '%s', cart/cut: %d/%d", ctx.ShowId, ctx.GroupName, ctx.Cart, ctx.Cut) @@ -448,7 +451,6 @@ func ImportFile(ctx *Context) (res *Result, err error) { rmCartOnErr := false rmCutOnErr := false - res = &Result{ResponseCode: http.StatusOK} if ctx.ShowId != 0 { // Import to a show var showCarts []uint if showCarts, err = ctx.getShowInfo(); err != nil { |