From 71dd539c760ca30ff6a97b068547745273e912c8 Mon Sep 17 00:00:00 2001 From: jygaulier Date: Mon, 6 Jul 2020 18:06:51 +0200 Subject: [PATCH 1/4] fix : if string cutting at 32766 OCTETS for es/lucene happened in the middle of a utf8 CHAR, string was invalid. --- .../SearchEngine/Elastic/RecordHelper.php | 33 +++++++++++-------- 1 file changed, 19 insertions(+), 14 deletions(-) diff --git a/lib/Alchemy/Phrasea/SearchEngine/Elastic/RecordHelper.php b/lib/Alchemy/Phrasea/SearchEngine/Elastic/RecordHelper.php index 6d19916e62..5cf26987ca 100644 --- a/lib/Alchemy/Phrasea/SearchEngine/Elastic/RecordHelper.php +++ b/lib/Alchemy/Phrasea/SearchEngine/Elastic/RecordHelper.php @@ -11,13 +11,10 @@ namespace Alchemy\Phrasea\SearchEngine\Elastic; -use Alchemy\Phrasea\SearchEngine\Elastic\Exception\MergeException; -use Alchemy\Phrasea\SearchEngine\Elastic\Mapping; -use Alchemy\Phrasea\SearchEngine\Elastic\Structure\Field; -use Alchemy\Phrasea\SearchEngine\Elastic\Structure\Flag; use appbox; use DateTime; -use igorw; +use Exception; + class RecordHelper { @@ -100,31 +97,31 @@ class RecordHelper $a = explode(';', preg_replace('/\D+/', ';', trim($value))); switch (count($a)) { case 1: // yyyy - $date = new \DateTime($a[0] . '-01-01'); // will throw if date is not valid + $date = new DateTime($a[0] . '-01-01'); // will throw if date is not valid $v_fix = $date->format('Y'); break; case 2: // yyyy;mm - $date = new \DateTime( $a[0] . '-' . $a[1] . '-01'); + $date = new DateTime( $a[0] . '-' . $a[1] . '-01'); $v_fix = $date->format('Y-m'); break; case 3: // yyyy;mm;dd - $date = new \DateTime($a[0] . '-' . $a[1] . '-' . $a[2]); + $date = new DateTime($a[0] . '-' . $a[1] . '-' . $a[2]); $v_fix = $date->format('Y-m-d'); break; case 4: - $date = new \DateTime($a[0] . '-' . $a[1] . '-' . $a[2] . ' ' . $a[3] . ':00:00'); + $date = new DateTime($a[0] . '-' . $a[1] . '-' . $a[2] . ' ' . $a[3] . ':00:00'); $v_fix = $date->format('Y-m-d H:i:s'); break; case 5: - $date = new \DateTime($a[0] . '-' . $a[1] . '-' . $a[2] . ' ' . $a[3] . ':' . $a[4] . ':00'); + $date = new DateTime($a[0] . '-' . $a[1] . '-' . $a[2] . ' ' . $a[3] . ':' . $a[4] . ':00'); $v_fix = $date->format('Y-m-d H:i:s'); break; case 6: - $date = new \DateTime($a[0] . '-' . $a[1] . '-' . $a[2] . ' ' . $a[3] . ':' . $a[4] . ':' . $a[5]); + $date = new DateTime($a[0] . '-' . $a[1] . '-' . $a[2] . ' ' . $a[3] . ':' . $a[4] . ':' . $a[5]); $v_fix = $date->format('Y-m-d H:i:s'); break; } - } catch (\Exception $e) { + } catch (Exception $e) { // no-op, v_fix = null } @@ -151,8 +148,16 @@ class RecordHelper return (bool) $value; case FieldMapping::TYPE_STRING: - $value = substr($value, 0, 32766); // for lucene limit, before a better solution - return str_replace("\0", '', $value); + $value = str_replace("\0", '', $value); // no null char for lucene ! + if( strlen($value) > 32766) { // for lucene limit, before a better solution + for($l=32766; $l > 0; $l--) { + if(ord(substr($value, $l-1, 1)) < 128) { + break; + } + } + $value = substr($value, 0, $l); + } + return $value; default: return $value; From 9af8f50fe95aa3b8cb31340af2281235649eddbf Mon Sep 17 00:00:00 2001 From: Harrys Ravalomanana Date: Tue, 7 Jul 2020 20:41:48 +0400 Subject: [PATCH 2/4] PHRAS-3169 : video subtitle with cue number --- package.json | 2 +- yarn.lock | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/package.json b/package.json index c51d6fd6f8..32d86f2c0c 100644 --- a/package.json +++ b/package.json @@ -65,7 +65,7 @@ "normalize-css": "^2.1.0", "npm": "^6.0.0", "npm-modernizr": "^2.8.3", - "phraseanet-production-client": "0.34.248-d", + "phraseanet-production-client": "0.34.253-d", "requirejs": "^2.3.5", "tinymce": "^4.0.28", "underscore": "^1.8.3", diff --git a/yarn.lock b/yarn.lock index 43cc3ddc1c..40f9625a44 100644 --- a/yarn.lock +++ b/yarn.lock @@ -7678,10 +7678,10 @@ phraseanet-common@^0.4.5-d: js-cookie "^2.1.0" pym.js "^1.3.1" -phraseanet-production-client@0.34.248-d: - version "0.34.248-d" - resolved "https://registry.yarnpkg.com/phraseanet-production-client/-/phraseanet-production-client-0.34.248-d.tgz#92b23159cff6437b9aba0a2a9cbc63979b4c68c6" - integrity sha512-DgIToC7zdKBIvH47Rr2fceMJT4Aj8WQcHftEBqqFVTH/qQ4kLFMOZqR6aTezwlHms11opZ5s5CFVvM3kkVqa/w== +phraseanet-production-client@0.34.253-d: + version "0.34.253-d" + resolved "https://registry.yarnpkg.com/phraseanet-production-client/-/phraseanet-production-client-0.34.253-d.tgz#b835b492a86b24c6f3b18d9d27be48d58434257c" + integrity sha512-A9DVVvfJ1duJsRcV4qnPX/78xwvMKlHXQZSxy7RnXypTOp+dMjGgPX+YCeL77OYCiqINFZnkW+OUIn13kaeZlw== dependencies: "@mapbox/mapbox-gl-language" "^0.9.2" "@turf/turf" "^5.1.6" From 9b0c5634d453e48e0cf76ad25f6fb30eddfe8cab Mon Sep 17 00:00:00 2001 From: Harrys Ravalomanana Date: Wed, 8 Jul 2020 18:32:01 +0400 Subject: [PATCH 3/4] PHRAS-3169 video subtitle : add number on saving --- package.json | 2 +- yarn.lock | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/package.json b/package.json index c255568100..4d4e4caab2 100644 --- a/package.json +++ b/package.json @@ -65,7 +65,7 @@ "normalize-css": "^2.1.0", "npm": "^6.0.0", "npm-modernizr": "^2.8.3", - "phraseanet-production-client": "0.34.254-d", + "phraseanet-production-client": "0.34.255-d", "requirejs": "^2.3.5", "tinymce": "^4.0.28", "underscore": "^1.8.3", diff --git a/yarn.lock b/yarn.lock index e716aea776..30158d604e 100644 --- a/yarn.lock +++ b/yarn.lock @@ -7678,10 +7678,10 @@ phraseanet-common@^0.4.5-d: js-cookie "^2.1.0" pym.js "^1.3.1" -phraseanet-production-client@0.34.254-d: - version "0.34.254-d" - resolved "https://registry.yarnpkg.com/phraseanet-production-client/-/phraseanet-production-client-0.34.254-d.tgz#52a798b8c1f9994cf677db6ad6aeb9909c811f80" - integrity sha512-EvTbTbDbdoWGfqZtqJGEl6xeE6vyk43IF5eVMCy7c6qkaYjTuyiTqvI8eMXSJ2gKvsEidaa6AsHigUL9lKuVcA== +phraseanet-production-client@0.34.255-d: + version "0.34.255-d" + resolved "https://registry.yarnpkg.com/phraseanet-production-client/-/phraseanet-production-client-0.34.255-d.tgz#40e9c97ebb5fd77dd117f2d766126a94437b63ff" + integrity sha512-UQpkjhkKLPF63107y1nG+cd1wxUq2jAmbO58yrp3tJLsfQt1nGAkUfvZb9VEJ3/zbvKcjRmjnHHFDa08RcViww== dependencies: "@mapbox/mapbox-gl-language" "^0.9.2" "@turf/turf" "^5.1.6" From 8ca946be9373bf15b1d636a604e6ce0fed6ec990 Mon Sep 17 00:00:00 2001 From: nmaillat Date: Wed, 8 Jul 2020 22:42:01 +0200 Subject: [PATCH 4/4] PHRAS-3173 change xpdf in favor of poppler-utils --- Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index a730e9dd2b..738031c4ec 100644 --- a/Dockerfile +++ b/Dockerfile @@ -37,7 +37,7 @@ RUN echo "deb http://deb.debian.org/debian stretch main non-free" > /etc/apt/sou swftools \ unoconv \ unzip \ - xpdf \ + poppler-utils \ libreoffice-base-core \ libreoffice-impress \ libreoffice-calc \