Don't forget to lycansubscribe

check posts for null bytes

Changed files
+7
app
models
+7
app/models/post.rb
··· 10 10 validates_length_of :text, maximum: 1000 11 11 validates_length_of :data, maximum: 10000 12 12 13 + validate :check_null_bytes 14 + 13 15 belongs_to :user 14 16 15 17 has_many :likes, dependent: :delete_all ··· 26 28 27 29 def at_uri 28 30 "at://#{user.did}/app.bsky.feed.post/#{rkey}" 31 + end 32 + 33 + def check_null_bytes 34 + # Postgres doesn't allow null bytes in strings 35 + errors.add(:text, 'must not contain a null byte') if text.include?("\u0000") 29 36 end 30 37 end