5
0
Fork 0
mirror of https://0xacab.org/sutty/sutty synced 2024-06-29 21:46:07 +00:00

fix: limitar el nombre del archivo #14946

(cherry picked from commit ee7d1599e8)
This commit is contained in:
f 2024-01-09 18:27:02 -03:00 committed by Sutty
parent 8f80d44c53
commit c787c1db87

View file

@ -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