mirror of
https://0xacab.org/sutty/sutty
synced 2024-11-17 06:36:22 +00:00
fix: limitar el nombre del archivo #14946
(cherry picked from commit ee7d1599e8
)
This commit is contained in:
parent
8f80d44c53
commit
c787c1db87
1 changed files with 9 additions and 1 deletions
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue