Update src/invidious/videos/description.cr

Co-authored-by: Fijxu <fijxu@nadeko.net>
This commit is contained in:
shiny-comic 2026-02-17 13:42:19 +09:00 committed by GitHub
parent 698cd49529
commit 44a5ea5eeb
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -50,7 +50,8 @@ def parse_description(desc, video_id : String) : String?
# Slightly faster than HTML.escape, as we're only doing one pass on
# the string instead of five for the standard library
return String.build do |str|
copy_string(str, content.each_codepoint, utf16_length(content))
content_size = content.ascii_only? ? content.size : utf16_length(content)
copy_string(str, content.each_codepoint, content_size)
end
end