Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Emoji autocomplete causes 500 Internal Server Error when writing links #5691

Open
nottalulah opened this issue Apr 29, 2024 · 0 comments
Open
Labels

Comments

@nottalulah
Copy link
Contributor

Mildly annoying. Typing "a":[ produces the following error:

RegexpError at /autocomplete

premature end of char-class: /[/i

app/logical/autocomplete_service.rb, line 384

  379     # @return [Array<Hash>] the autocomplete results
  380     def autocomplete_emoji(emoji)
  381       normalized_emoji = emoji.downcase.chomp(":")
  382       emojis = Danbooru.config.dtext_emojis.keys
  383   
> 384       results = emojis.grep(/#{normalized_emoji}/i).sort_by do |match|
  385         exact = match.casecmp?(normalized_emoji) ? 1 : 0
  386         prefix = match.downcase.starts_with?(normalized_emoji) ? 1 : 0
  387   
  388         # Sort exact name matches first, then prefix matches, then sort by name.
  389         [-exact, -prefix, match]

App backtrace

  • app/logical/autocomplete_service.rb:384:in `autocomplete_emoji'
  • app/logical/autocomplete_service.rb:78:in `autocomplete_results'
  • app/controllers/autocomplete_controller.rb:12:in `index'
  • app/logical/rack_server_timing.rb:19:in `call'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants