Commit Graph

19 Commits

Author SHA1 Message Date
evazion
07e23204b6 rubocop: fix various Rubocop warnings. 2021-06-17 04:17:53 -05:00
nonamethanks
26a6335c41 Uploads: get rid of same-source existence check
Remove the lines that checked for existing upload with the same source.
These lines were breaking replacements in many cases, so we had to
always empty the post's source before replacing, and they served no
purpose since the md5 check already catches duplicate uploads.
2020-12-14 16:41:06 +01:00
nonamethanks
3179509791 Uploads: Check if strategy is enabled before use
Avoid returning bare API tracebacks from pixiv et al when login details
are not configured, and instead raise a generic error.
2020-07-11 04:56:46 +02:00
evazion
b551e3634f Fix misc rubocop warnings. 2020-06-16 21:36:15 -05:00
evazion
f38c38f26e search: split tag_match into user_tag_match / system_tag_match.
When doing a tag search, we have to be careful about which user we're
running the search as because the results depend on the current user.
Specifically, things like private favorites, private favorite groups,
post votes, saved searches, and flagger names depend on the user's
permissions, and whether non-safe or deleted posts are filtered out
depend on whether the user has safe mode on or the hide deleted posts
setting enabled.

* Refactor internal searches to explicitly state whether they're
  running as the system user (DanbooruBot) or as the current user.
* Explicitly pass in the current user to PostQueryBuilder instead of
  implicitly relying on the CurrentUser global.
* Get rid of CurrentUser.admin_mode? (used to ignore the hide deleted
  post setting) and CurrentUser.without_safe_mode (used to ignore safe
  mode).
* Change the /counts/posts.json endpoint to ignore safe mode and the
  hide deleted posts settings when counting posts.
* Fix searches not correctly overriding the hide deleted posts setting
  when multiple status: metatags were used (e.g. `status:banned status:active`)
* Fix fast_count not respecting the hide deleted posts setting when the
  status:banned metatag was used.
2020-05-07 03:29:44 -05:00
evazion
e477232e02 uploads: factor out image dimension and filetype detection code.
* Add MediaFile abstraction. A MediaFile represents an image or video file.
* Move filetype detection and dimension parsing code from uploads to MediaFile.
2020-05-06 00:33:35 -05:00
evazion
309821bf73 rubocop: fix various style issues. 2019-12-22 21:23:37 -06:00
lllusion3469
e21f067fab #3767: Prioritize md5 check over source download
in case both an upload from disk and a source were specified, this caused
an md5 mismatch error to be thrown
2018-12-14 22:23:47 +01:00
evazion
a20eba9ef7 Fix #3983: Uploads: NoMethodError - undefined method `>=' for nil:NilClass
* Rename Upload#download_for_upload to #get_file_for_upload.

* Fix #get_file_for_upload to raise error if no file or source url was given.

* Fix javascript upload validation to disallow submitting form if file is
  not present and the source is not an url.
2018-11-11 17:12:39 -06:00
evazion
e10c6c6a30 Fix #3982: Uploads: URI::InvalidURIError - URI must be ascii only. 2018-11-11 12:17:58 -06:00
Albert Yi
6dd64da9ba fix invalid content type leaving upload stuck in preprocessing status (#3896) 2018-09-13 13:50:18 -07:00
Albert Yi
762dc3da24 Refactor sources 2018-08-24 12:10:51 -07:00
Albert Yi
80e0ae6a3c hide detailed exception info in upload status (#3804) 2018-08-07 13:05:06 -07:00
r888888888
660cd6ce62 export blacklist, comment, dtext, postmodemenu, and note javascripts (#3795) 2018-08-04 17:13:26 -07:00
r888888888
9c5df3206d cleanup comments 2018-08-04 16:33:18 -07:00
r888888888
334d8b7c6f Add alt_source field on uploads to deal with twitter galleries 2018-08-04 16:32:15 -07:00
Albert Yi
f6440ca70d fix upload preprocessing for pixiv posts
fixes #3782
2018-07-23 16:24:31 -07:00
Albert Yi
6943c70a32 potential fix for #3569 2018-07-20 10:55:39 -07:00
Albert Yi
ac28c92fbd refactor upload service 2018-07-06 11:52:43 -07:00