Page MenuHomePhabricator

Images are not being uploaded to creative commons from google drive
Closed, ResolvedPublicBUG REPORT

Description

Testing done on Windows 10, Ubuntu 18.04, mac OS and Android 10(Mobile browser)
Steps to Reproduce:
Login to Wikimedia commons with meta account
Login to google drive with google account
Select images to be uploaded from google drive
Select the "Upload to Wikimedia commons" action button

Actual Results:
After clicking on the "Upload to Wikimedia commons" button, the button gets a bit transparent but there is no action taken, that is, the images are not being uploaded to commons and also if we again click on that button it gets back to it's original state and there is no uploading happening. Hence when we click the upload button, the graphic of button is only hanged but there is nothing else happening.

image (3) (1).png (699×1 px, 147 KB)

Expected Results:
After clicking in the "Upload to Wikimedia commons" button, the upload should start and images should be uploaded to Wikimedia commons from google drive.

Event Timeline

Rishikabhatia17 renamed this task from Images are not uploading to creative commons from google drive to Images are not being uploaded to creative commons from google drive.

I have followed the local environment setup instructions that were mentioned in the documentation. I have got all the Google Cloud Platform related keys and pasted them in the local settings.
Then, I have started the process to request for an OAuth client using Wikimedia:OAuth by filling the following form: https://meta.wikimedia.org/wiki/Special:OAuthConsumerRegistration/propose
In the 1st try, I have set the MediaWiki OAuth Callback URL as http://127.0.0.1:8000/ (Local host) and I was facing a problem while running the application
In the 2nd try, I have set the MediaWiki OAuth Callback URL as https://tools.wmflabs.org/google-drive-photos-to-commons/upload/? (Choose Photos from Google Drive button page) and I have got both the keys.
Then I have pasted the keys in local_settings.py file and then I have Run the Django standard runserver. Now I'm able to upload the file to Wikimedia commons from google drive successfully as shown below.

image.png (957×1 px, 485 KB)

Also, I have used the dev keys as given in the https://phabricator.wikimedia.org/P10014
The only keys I have changed are the OAuth client using Wikimedia:OAuth because I felt there was a mistake in the callback URL.
I'm also able to upload images multiple times.
Hence I would request you to generate new OAuth client using Wikimedia:OAuth by setting the MediaWiki OAuth Callback URL as https://tools.wmflabs.org/google-drive-photos-to-commons/upload/? (Choose Photos from Google Drive button page) and paste both the newly generated keys in local settings.py and run the tool and test it.
So, I feel that the solution for the primary bug is found out now and it would be a great help if you can test this method and let me know.

The only keys I have changed are the OAuth client using Wikimedia:OAuth because I felt there was a mistake in the callback URL.

Did you get an error message or something like that ? It would be interesting to see why that is happening.

Hi @01tonythomas
I have first started setting up the local environment by following the steps given in "steps for local development" documentation After reaching step 4: setting up the local settings by modifying the values of keys I have started following "Pre-requisites for local development" documentation to get the keys.
First I got the gcp credentials and then I have got the OAuth client keys using Wikimedia:OAuth. While getting OAuth client keys I didn't know what to set MediaWiki OAuth Callback URL as. So I first set it as localhost 8000.
Then I have run the the Django standard runserver.
After logging in to Wikimedia commons account and giving OAuth permissions I was again redirected to the first introduction page. Then I understood that callback URL should be set as the page which should be coming after logging into the Wikimedia commons.
Then I have generated the OAuth client keys using Wikimedia:OAuth but this time setting the MediaWiki OAuth Callback URL as https://tools.wmflabs.org/google-drive-photos-to-commons/upload/
Then I have tested the tool locally and the tool was working perfectly and the images were being uploaded to Wikimedia commons and we're visible to the public and I was also able to upload multiple images. Also after you have suggested me to use your dev keys I have used your gcp keys (used my OAuth client keys because I have changed the callback URL) and tested the tool and then also it was working perfectly.
I felt that there was error in the callback URL because of my first try and also you have mentioned in the documentation for prerequisites that "remember that you set the right Mediawiki OAuth callback url".
Thanks!

Hi @01tonythomas since we are providing the callback url as https://tools.wmflabs.org/google-drive-photos-to-commons/upload/ and not http://127.0.0.1:8000/, we are being redirected to the hosted tool rather than the local development environment. From there on, any changes we make to functionalities in the local code won't be visible to us because it is being redirected to the online hosted tool. Any workaround for this? As mentioned before, changing the callback url to http://127.0.0.1:8000/ leads to some errors while running the application.

Also a couple of observations -

  1. Firefox - Even after using the method as suggested by @Rishikabhatia17 I am not able to choose photos from Google Drive. The button just gets highlighted and nothing happens beyond this.
    Screenshot from 2020-03-16 11-36-49.png (1×1 px, 152 KB)
  1. Chrome - I am able to select photos but not able to upload to Wikimedia commons. The button just turns blue.
    Screenshot from 2020-03-16 11-37-36.png (1×1 px, 463 KB)

I think the issue here was using the wrong OAuth consumer. I think we had this sorted out by giving development secrets now visible at https://github.com/tonythomas01/gdrive-to-commons/blob/master/README.md. However, the best solution is always to add documentation to make it work against a local wiki.

01tonythomas claimed this task.

I will close it as Resolved as we have documentation to never hit this problem anymore.