Change media description length limit for remote media attachments from 1500 to 10000 characters (#37921)

This commit is contained in:
Claire
2026-03-23 11:32:41 +01:00
parent f37dc6c59e
commit 1fa9451603
3 changed files with 3 additions and 1 deletions

View File

@@ -67,3 +67,4 @@ The following table attempts to summary those limits.
| Account `attributionDomains` | 256 | List will be truncated |
| Account aliases (actor `alsoKnownAs`) | 256 | List will be truncated |
| Custom emoji shortcode (`Emoji` `name`) | 2048 | Emoji will be rejected |
| Media descriptions (`name`/`summary`) | 10000 | Description will be truncated |

View File

@@ -30,7 +30,7 @@ class ActivityPub::Parser::MediaAttachmentParser
def description
str = @json['summary'].presence || @json['name'].presence
str = str.strip[0...MediaAttachment::MAX_DESCRIPTION_LENGTH] if str.present?
str = str.strip[0...MediaAttachment::MAX_DESCRIPTION_HARD_LENGTH_LIMIT] if str.present?
str
end

View File

@@ -38,6 +38,7 @@ class MediaAttachment < ApplicationRecord
enum :processing, { queued: 0, in_progress: 1, complete: 2, failed: 3 }, prefix: true
MAX_DESCRIPTION_LENGTH = 1_500
MAX_DESCRIPTION_HARD_LENGTH_LIMIT = 10_000
IMAGE_LIMIT = 16.megabytes
VIDEO_LIMIT = 99.megabytes