|
|
|
@@ -278,7 +278,21 @@ func GetAttachment(ctx *context.Context) { |
|
|
|
ctx.ServerError("Update", err) |
|
|
|
return |
|
|
|
} |
|
|
|
http.Redirect(ctx.Resp, ctx.Req.Request, url, http.StatusMovedPermanently) |
|
|
|
if dataSet != nil { |
|
|
|
http.Redirect(ctx.Resp, ctx.Req.Request, url, http.StatusMovedPermanently) |
|
|
|
} else { |
|
|
|
fr, err := storage.Attachments.Open(attach.RelativePath()) |
|
|
|
if err != nil { |
|
|
|
ctx.ServerError("Open", err) |
|
|
|
return |
|
|
|
} |
|
|
|
defer fr.Close() |
|
|
|
if err = ServeData(ctx, attach.Name, fr); err != nil { |
|
|
|
ctx.ServerError("ServeData", err) |
|
|
|
return |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
} else { |
|
|
|
fr, err := storage.Attachments.Open(attach.RelativePath()) |
|
|
|
if err != nil { |
|
|
|
|