Skip to content

Enforce tag length limits#735

Merged
Meow merged 2 commits into
masterfrom
tag-length-limit
Jul 18, 2026
Merged

Enforce tag length limits#735
Meow merged 2 commits into
masterfrom
tag-length-limit

Conversation

@Meow

@Meow Meow commented Jul 18, 2026

Copy link
Copy Markdown
Member

Fixes #668

Set to a fairly generous limit of 256 bytes. Subject to change.

Querying Derpibooru database reveals that 102 tags are over the 256 byte length. Looking at which ones exactly, I can confidently say, none of them are going to be missed.

EDIT: also fixed a bug where autocomplete binary was incorrectly capped to 254 byte instead of 255 byte tag names.

@mdashlw

mdashlw commented Jul 18, 2026

Copy link
Copy Markdown
Contributor

There was an idea before to make it 255 bytes specifically. Any reason against it?

@Meow

Meow commented Jul 18, 2026

Copy link
Copy Markdown
Member Author

@mdashlw 256 seemed like a nice round number

@mdashlw

mdashlw commented Jul 18, 2026

Copy link
Copy Markdown
Contributor

@mdashlw 256 seemed like a nice round number

The justification was that 255 bytes is what the binary format of local autocomplete supports max:

# Names longer than 255 bytes do not fit and will break parsing.
# Sort is done in the application to avoid collation.
tags =
LocalAutocomplete.get_tags(@top_tags)
|> Enum.filter(&(byte_size(&1.name) < 255))

Note the byte vs character distinction too

@Meow
Meow force-pushed the tag-length-limit branch from 5ad8504 to e9cbe30 Compare July 18, 2026 15:26
@Meow
Meow merged commit ac450f5 into master Jul 18, 2026
12 checks passed
@Meow
Meow deleted the tag-length-limit branch July 18, 2026 15:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Tags need a name length limit

3 participants