From 619be6ddfd39f70e5207cb3b6abd2c94e20c49b7 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Roland=20H=C3=A4der?= Date: Tue, 7 Aug 2012 16:26:55 +0000 Subject: [PATCH] Remove last CHUNK_SEPARATOR or else the final chunk will be empty ... --- .../hub/main/package/assembler/class_PackageAssembler.php | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/application/hub/main/package/assembler/class_PackageAssembler.php b/application/hub/main/package/assembler/class_PackageAssembler.php index de0148813..36e36dc92 100644 --- a/application/hub/main/package/assembler/class_PackageAssembler.php +++ b/application/hub/main/package/assembler/class_PackageAssembler.php @@ -193,6 +193,12 @@ class PackageAssembler extends BaseHubSystem implements Assembler, Registerable // Debug message /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput('PACKAGE-ASSEMBLER: Last block of partial data received. A total of ' . strlen($packageContent[BaseRawDataHandler::PACKAGE_RAW_DATA]) . ' bytes has been received.'); + // Make sure last CHUNK_SEPARATOR is not there + if (substr($packageContent[BaseRawDataHandler::PACKAGE_RAW_DATA], -1, 1) == PackageFragmenter::CHUNK_SEPARATOR) { + // Remove it + $packageContent[BaseRawDataHandler::PACKAGE_RAW_DATA] = substr($packageContent[BaseRawDataHandler::PACKAGE_RAW_DATA], 0, -1); + } // END - if + /* * "explode" the string from 'raw_data' with chunk separator to * get an array of chunks. These chunks must then be verified by -- 2.39.5