From 97905b7e0a030b8c657888d6361c43b1078d182d Mon Sep 17 00:00:00 2001 From: Ricardo Monla Date: Sun, 4 Oct 2026 17:45:18 -0300 Subject: [PATCH] =?UTF-8?q?fix(nexxa):=201.4.2=20=E2=80=94=20leer=20el=20H?= =?UTF-8?q?TML=20como=20UTF-8=20(la=201.4.1=20daba=20500=20en=20la=20p?= =?UTF-8?q?=C3=A1gina=20de=20inicio=20bajo=20el=20locale=20C=20de=20system?= =?UTF-8?q?d)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit El gsub del cache busting sobre File.read sin encoding fallaba con 'invalid byte sequence in US-ASCII'. El servidor de prueba ahora corre con LC_ALL=C como el nodo, para que la suite lo detecte. Co-Authored-By: Claude Opus 5.5 Co-Authored-By: GEMMA --- servicios/nexxa/organismo/VERSION | 2 +- servicios/nexxa/organismo/server.rb | 3 ++- servicios/nexxa/test/lib_servidor_prueba.rb | 3 ++- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/servicios/nexxa/organismo/VERSION b/servicios/nexxa/organismo/VERSION index 347f5833..9df886c4 100644 --- a/servicios/nexxa/organismo/VERSION +++ b/servicios/nexxa/organismo/VERSION @@ -1 +1 @@ -1.4.1 +1.4.2 diff --git a/servicios/nexxa/organismo/server.rb b/servicios/nexxa/organismo/server.rb index 73fa156f..7e617e45 100644 --- a/servicios/nexxa/organismo/server.rb +++ b/servicios/nexxa/organismo/server.rb @@ -143,7 +143,8 @@ LOGIN_FILE = File.expand_path('login.html', WEB_DIR).freeze # agrega ?v= a cada /js/ y /css/: cada versión nueva obliga a bajar los archivos nuevos. El HTML en sí no se # cachea (no-cache), así siempre trae la versión vigente. def html_con_version(ruta) - File.read(ruta).gsub(%r{(["'])(/(?:js|css)/[^"'?]+\.(?:js|css))\1}) { "#{$1}#{$2}?v=#{version_actual}#{$1}" } + # encoding explícito: systemd corre con locale C (US-ASCII) y el gsub sobre un HTML con acentos daba 500 (1.4.1) + File.read(ruta, encoding: 'UTF-8').gsub(%r{(["'])(/(?:js|css)/[^"'?]+\.(?:js|css))\1}) { "#{$1}#{$2}?v=#{version_actual}#{$1}" } end server.mount_proc '/' do |req, res| diff --git a/servicios/nexxa/test/lib_servidor_prueba.rb b/servicios/nexxa/test/lib_servidor_prueba.rb index d807ab07..84a54950 100644 --- a/servicios/nexxa/test/lib_servidor_prueba.rb +++ b/servicios/nexxa/test/lib_servidor_prueba.rb @@ -37,7 +37,8 @@ module ServidorPrueba # Arranca server.rb de la copia y espera el puerto. => pid def arrancar(prueba, log: File.join(prueba[:dir], 'server.log')) - pid = Process.spawn('ruby', 'server.rb', chdir: prueba[:org], out: File::NULL, err: log) + # Locale C como systemd en el nodo: un File.read sin encoding explícito falla acá igual que en producción (1.4.1) + pid = Process.spawn({ 'LC_ALL' => 'C', 'LANG' => 'C' }, 'ruby', 'server.rb', chdir: prueba[:org], out: File::NULL, err: log) 60.times { abierto?(prueba[:puerto]) ? break : sleep(0.25) } raise "El server de prueba no abrió el puerto #{prueba[:puerto]} (ver #{log})" unless abierto?(prueba[:puerto])