Change media description length limit for remote media attachments from 1500 to 10000 characters (#37921)
This commit is contained in:
@@ -67,3 +67,4 @@ The following table attempts to summary those limits.
|
|||||||
| Account `attributionDomains` | 256 | List will be truncated |
|
| Account `attributionDomains` | 256 | List will be truncated |
|
||||||
| Account aliases (actor `alsoKnownAs`) | 256 | List will be truncated |
|
| Account aliases (actor `alsoKnownAs`) | 256 | List will be truncated |
|
||||||
| Custom emoji shortcode (`Emoji` `name`) | 2048 | Emoji will be rejected |
|
| Custom emoji shortcode (`Emoji` `name`) | 2048 | Emoji will be rejected |
|
||||||
|
| Media descriptions (`name`/`summary`) | 10000 | Description will be truncated |
|
||||||
|
|||||||
@@ -30,7 +30,7 @@ class ActivityPub::Parser::MediaAttachmentParser
|
|||||||
|
|
||||||
def description
|
def description
|
||||||
str = @json['summary'].presence || @json['name'].presence
|
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
|
str
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@@ -38,6 +38,7 @@ class MediaAttachment < ApplicationRecord
|
|||||||
enum :processing, { queued: 0, in_progress: 1, complete: 2, failed: 3 }, prefix: true
|
enum :processing, { queued: 0, in_progress: 1, complete: 2, failed: 3 }, prefix: true
|
||||||
|
|
||||||
MAX_DESCRIPTION_LENGTH = 1_500
|
MAX_DESCRIPTION_LENGTH = 1_500
|
||||||
|
MAX_DESCRIPTION_HARD_LENGTH_LIMIT = 10_000
|
||||||
|
|
||||||
IMAGE_LIMIT = 16.megabytes
|
IMAGE_LIMIT = 16.megabytes
|
||||||
VIDEO_LIMIT = 99.megabytes
|
VIDEO_LIMIT = 99.megabytes
|
||||||
|
|||||||
Reference in New Issue
Block a user