2
0
mirror of https://github.com/inventree/InvenTree.git synced 2025-07-12 07:54:14 +00:00

Some tweaks

- Add (unused) function to download an external file
- JS tweaks
This commit is contained in:
Oliver Walters
2019-05-07 08:07:33 +10:00
parent e0b4a59258
commit 0969edc431
3 changed files with 74 additions and 4 deletions

View File

@ -319,7 +319,7 @@ class UploadPartImage(AjaxView):
return JsonResponse(response, status=status)
elif 'image_url' in request.POST:
image_url = request.POST['image_url']
image_url = str(request.POST['image_url']).split('?')[0]
validator = URLValidator()
@ -334,6 +334,7 @@ class UploadPartImage(AjaxView):
# Test the the URL at least looks like an image
if not TestIfImageURL(image_url):
response['error'] = 'Invalid image URL'
response['url'] = image_url
return JsonResponse(response, status=400)
response['error'] = 'Cannot download cross-site images (yet)'