summaryrefslogtreecommitdiff
path: root/rhimport/importer.go
diff options
context:
space:
mode:
Diffstat (limited to 'rhimport/importer.go')
-rw-r--r--rhimport/importer.go8
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 {