fix build
This commit is contained in:
parent
bf4d98e89d
commit
0cd9e2acb9
|
@ -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
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue