Skip to content
Snippets Groups Projects
Unverified Commit 709876bd authored by Takeshi Umeda's avatar Takeshi Umeda Committed by GitHub
Browse files

Fix invalid blurhash handling in Create activity (#16583)

parent 590e1578
No related branches found
No related tags found
No related merge requests found
......@@ -446,10 +446,14 @@ class ActivityPub::Activity::Create < ActivityPub::Activity
end
def supported_blurhash?(blurhash)
components = blurhash.blank? ? nil : Blurhash.components(blurhash)
components = blurhash.blank? || !blurhash_valid_chars?(blurhash) ? nil : Blurhash.components(blurhash)
components.present? && components.none? { |comp| comp > 5 }
end
def blurhash_valid_chars?(blurhash)
/^[\w#$%*+-.:;=?@\[\]^{|}~]+$/.match?(blurhash)
end
def skip_download?
return @skip_download if defined?(@skip_download)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment