From 6561a613d765ba2fbc6e2ce0c72ff00e585e4524 Mon Sep 17 00:00:00 2001 From: Oliver Walters Date: Sat, 11 May 2019 00:07:21 +1000 Subject: [PATCH] Add extra validation step --- InvenTree/stock/api.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/InvenTree/stock/api.py b/InvenTree/stock/api.py index f67f97f4b6..7397f45370 100644 --- a/InvenTree/stock/api.py +++ b/InvenTree/stock/api.py @@ -154,7 +154,10 @@ class StockMove(APIView): if 'location' not in data: raise ValidationError({'location': 'Destination must be specified'}) - loc_id = data.get(u'location') + try: + loc_id = int(data.get('location')) + except ValueError: + raise ValidationError({'location': 'Integer ID required'}) try: location = StockLocation.objects.get(pk=loc_id)