Skip to content

Commit

Permalink
Merge pull request #2238 from onaio/fix-xlsx-url-upload
Browse files Browse the repository at this point in the history
Fix xlsx url upload
  • Loading branch information
KipSigei authored May 20, 2022
2 parents ec18455 + f3b4043 commit 089da75
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 1 deletion.
2 changes: 1 addition & 1 deletion onadata/apps/main/forms.py
Original file line number Diff line number Diff line change
Expand Up @@ -410,7 +410,7 @@ def publish(self, user, id_string=None, created_by=None):
name, extension = os.path.splitext(cleaned_xls_file)

if extension not in VALID_FILE_EXTENSIONS and name:
response = requests.head(cleaned_url)
response = requests.head(cleaned_url, allow_redirects=True)
if (
response.headers.get("content-type")
in VALID_XLSFORM_CONTENT_TYPES
Expand Down
1 change: 1 addition & 0 deletions onadata/apps/main/tests/test_process.py
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,7 @@ def test_google_url_upload(self, mock_requests):
)

mock_requests.get.assert_called_with(xls_url)
mock_requests.head.assert_called_with(xls_url, allow_redirects=True)
# make sure publishing the survey worked
self.assertEqual(response.status_code, 200)
self.assertEqual(XForm.objects.count(), pre_count + 1)
Expand Down

0 comments on commit 089da75

Please sign in to comment.