From 470d7c09ef0fc598217295482d2bc3843ba32580 Mon Sep 17 00:00:00 2001 From: Alfred Egger Date: Mon, 24 Jun 2019 23:53:07 +0200 Subject: [PATCH] Fix Javascript and LPR shell command --- js/printer.tabview.js | 2 +- lib/Controller/PrinterController.php | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/js/printer.tabview.js b/js/printer.tabview.js index dffdd40..31f6172 100644 --- a/js/printer.tabview.js +++ b/js/printer.tabview.js @@ -76,7 +76,7 @@ } var url = OC.generateUrl('/apps/printer/printfile'), - data = {source: fileInfo.getFullPath(), orientation: orientation}, + data = {sourcefile: fileInfo.getFullPath(), orientation: orientation}, _self = this; $.ajax({ type: 'GET', diff --git a/lib/Controller/PrinterController.php b/lib/Controller/PrinterController.php index 956144d..865e32a 100644 --- a/lib/Controller/PrinterController.php +++ b/lib/Controller/PrinterController.php @@ -29,7 +29,7 @@ class PrinterController extends Controller { public function printfile($sourcefile, $orientation) { if($orientation === "landscape") { $filefullpath = \OC\Files\Filesystem::getLocalFile($sourcefile); - exec('lpr ' . $filefullpath); + exec('sudo lpr "' . $filefullpath . '"'); return new JSONResponse( array( 'response' => 'success', @@ -40,7 +40,7 @@ class PrinterController extends Controller { if($orientation === "portrait"){ $filefullpath = \OC\Files\Filesystem::getLocalFile($sourcefile); - exec('lpr -o orientation-requested=4 ' . $filefullpath); + exec('sudo lpr -o orientation-requested=4 "' . $filefullpath . '"'); return new JSONResponse( array( 'response' => 'success',