From c787c1db87a84b50fa8df03694f2d9251d9152e7 Mon Sep 17 00:00:00 2001 From: f Date: Tue, 9 Jan 2024 18:27:02 -0300 Subject: [PATCH] fix: limitar el nombre del archivo #14946 (cherry picked from commit ee7d1599e896f82accac69288edc6ff450a53c83) --- app/models/metadata_path.rb | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/app/models/metadata_path.rb b/app/models/metadata_path.rb index 95fc7dbb..17085e07 100644 --- a/app/models/metadata_path.rb +++ b/app/models/metadata_path.rb @@ -6,7 +6,7 @@ class MetadataPath < MetadataTemplate # # @return [String] def default_value - File.join(site.path, "_#{lang}", "#{date}-#{slug}#{ext}") + File.join(site.path, "_#{lang}", "#{limited_name}#{ext}") end # La ruta del archivo segĂșn Jekyll @@ -46,4 +46,12 @@ class MetadataPath < MetadataTemplate def date post.date.value.strftime('%F') end + + # Limita el nombre de archivo a 255 bytes, de forma que siempre + # podemos guardarlo + # + # @return [String] + def limited_name + "#{date}-#{slug}".mb_chars.limit(255 - ext.length) + end end