Skip to content

Commit

Permalink
Fix misparsing of post URLs.
Browse files Browse the repository at this point in the history
Fix `https://testbooru.donmai.us/posts/1` and `https://danbooru.donmai.us/posts/1/events`
URLs being replaced with Danbooru post embeds.
  • Loading branch information
evazion committed Sep 26, 2022
1 parent e79da54 commit f6d9cf5
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion lib/fumimi.rb
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ def self.respond(name, regex, &block)
def do_convert_post_links(event)
post_ids = []

message = event.message.content.gsub(%r!https?://\w+\.donmai\.us/posts/(\d+).*?\b!i) do |link|
message = event.message.content.gsub(%r{\b(?!https?://\w+\.donmai\.us/posts/\d+/\w+)https?://(?!testbooru)\w+\.donmai\.us/posts/(\d+)\b[^[:space:]]*}i) do |link|
post_ids << $1.to_i
"<#{link}>"
end
Expand Down

0 comments on commit f6d9cf5

Please sign in to comment.