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

Upload exceptions when both the file and source options are used #3767

Closed
BrokenEagle opened this issue Jun 25, 2018 · 3 comments
Closed

Upload exceptions when both the file and source options are used #3767

BrokenEagle opened this issue Jun 25, 2018 · 3 comments
Labels

Comments

@BrokenEagle
Copy link
Collaborator

Seems like there's still a few problems with uploading.

CodeKyuubi said (forum #148349):

Issue's been closed (I assume this implies that it was thought to be fixed), but I'm still getting exceptions returned when I fill both the file and source boxes

CodeKyuubi said (forum #148351):

https://i.imgur.com/GLHSzQQ.png

I got this error three times today, once with tumblr (liyart)(downloaded the raw and put it in file box and put the tumblr page link in source) and once with weibo (renatus)(likewise, downloaded full res (large) and put the weibo link in source), and once with sadpanda, where Danbooru tried to pull the sadpanda thumbnail before the pre-loaded file and returned an 'md5 already exists' error.

And I just now tested it with twitter, downloading the :orig and renaming it, then putting the file and source at the same time, returning the same error as above.

Also got this error: https://i.imgur.com/KiADgmx.png
When I accidentally closed the tab so I restored the tab and tried to re-pre-load the file and got that huge red shenanigen.

@BrokenEagle
Copy link
Collaborator Author

CodeKyuubi said (forum #1234):

A commit was pushed for issue #3767 but Danbooru still fails to upload with both the file and source boxes filled, prioritizing returning an error for md5 mismatching first and foremost before the file box, so any site where the auto-extracted image (or can't auto-extract) does not match the file (Twitter, patreonesque sites, e-h, etc...) fails the upload.

@lllusion3469
Copy link
Collaborator

lllusion3469 commented Oct 29, 2018

Happens for me too when manually uploading a file and specifying any source whatsoever.

Might be more complicated than this, but it seems to fix it for me:

--- a/app/logical/upload_service/preprocessor.rb
+++ b/app/logical/upload_service/preprocessor.rb
@@ -33,25 +33,25 @@ class UploadService
     memoize :canonical_source
 
     def in_progress?
-      if Utils.is_downloadable?(source)
-        return Upload.where(status: "preprocessing", source: source).exists?
-      end
-
       if md5.present?
         return Upload.where(status: "preprocessing", md5: md5).exists?
       end
 
+      if Utils.is_downloadable?(source)
+        return Upload.where(status: "preprocessing", source: source).exists?
+      end
+
       false
     end
 
     def predecessor
-      if Utils.is_downloadable?(source)
-        return Upload.where(status: ["preprocessed", "preprocessing"], source: source).first
-      end
-
       if md5.present?
         return Upload.where(status: ["preprocessed", "preprocessing"], md5: md5).first
       end
+
+      if Utils.is_downloadable?(source)
+        return Upload.where(status: ["preprocessed", "preprocessing"], source: source).first
+      end
     end
 
     def completed?

lllusion3469 added a commit to lllusion3469/danbooru that referenced this issue Dec 14, 2018
in case both an upload from disk and a source were specified, this caused
an md5 mismatch error to be thrown
r888888888 added a commit that referenced this issue Dec 17, 2018
#3767: Prioritize md5 check over source download
@stale
Copy link

stale bot commented Jul 29, 2019

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the stale label Jul 29, 2019
@stale stale bot closed this as completed Aug 12, 2019
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