fix build

This commit is contained in:
Régis Hanol 2018-08-04 01:56:26 +02:00
parent bf4d98e89d
commit 0cd9e2acb9
2 changed files with 12 additions and 6 deletions

View File

@ -87,6 +87,8 @@ class Upload < ActiveRecord::Base
path = uri.path[/(\/original\/\dX\/[\/\.\w]+)/, 1]
return if path.blank?
Upload.find_by("url LIKE ?", "%#{path}")
end

View File

@ -476,13 +476,17 @@ class Search
advanced_filter(/filetypes?:([a-zA-Z0-9,\-_]+)/) do |posts, match|
file_extensions = match.split(",").map(&:downcase)
posts.where("posts.id IN (
SELECT post_id FROM topic_links
WHERE extension IN (:file_extensions)
SELECT post_id
FROM topic_links
WHERE extension IN (:file_extensions)
UNION
SELECT post_uploads.post_id FROM uploads
JOIN post_uploads ON post_uploads.upload_id = uploads.id
WHERE lower(uploads.extension) IN (:file_extensions)
)", file_extensions: file_extensions)
SELECT post_uploads.post_id
FROM uploads
JOIN post_uploads ON post_uploads.upload_id = uploads.id
WHERE lower(uploads.extension) IN (:file_extensions)
)", file_extensions: file_extensions)
end
private