From 7f384f1964254e94f10fb0e8b0d5847031a7554a Mon Sep 17 00:00:00 2001 From: Martin Artnik Date: Mon, 24 Oct 2022 15:50:10 +0200 Subject: [PATCH] Only render last label in ZPL [SCI-7357] --- app/controllers/label_templates_controller.rb | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/app/controllers/label_templates_controller.rb b/app/controllers/label_templates_controller.rb index 547691d1e..a1d235a94 100644 --- a/app/controllers/label_templates_controller.rb +++ b/app/controllers/label_templates_controller.rb @@ -130,7 +130,9 @@ class LabelTemplatesController < ApplicationController def zpl_preview service = LabelTemplatesPreviewService.new(params, current_user) - payload = service.generate_zpl_preview! + + # only render last generated label image + payload = service.generate_zpl_preview!.split.last if service.error.blank? render json: { base64_preview: payload }