Skip to content

Commit c463c8a

Browse files
committed
Use JsonResponse #585
* Ensure that /tmp/minecode exists and that the purldb Docker user owns it Signed-off-by: Jono Yang <[email protected]>
1 parent a6a25a0 commit c463c8a

File tree

2 files changed

+7
-4
lines changed

2 files changed

+7
-4
lines changed

Dockerfile

+3-1
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,9 @@ RUN mkdir -p /var/$APP_NAME \
6161
&& chown $APP_USER:$APP_USER /var/$APP_NAME
6262
RUN mkdir -p /var/scancodeio \
6363
&& chown $APP_USER:$APP_USER /var/scancodeio
64-
64+
RUN mkdir -p /tmp/minecode \
65+
&& chown $APP_USER:$APP_USER /tmp/minecode
66+
6567
# Setup the work directory and the user as APP_USER for the remaining stages
6668
WORKDIR $APP_DIR
6769
USER $APP_USER

minecode/api.py

+4-3
Original file line numberDiff line numberDiff line change
@@ -13,16 +13,17 @@
1313
from django.core import signing
1414
from django.db import transaction
1515
from django.http import Http404
16+
from django.http import JsonResponse
1617
from django.shortcuts import get_object_or_404
1718
from django.utils import timezone
1819
from django.views.decorators.csrf import csrf_exempt
20+
from django.views.decorators.http import require_POST
1921

2022
from packageurl import PackageURL
2123
from rest_framework import serializers
2224
from rest_framework import status
2325
from rest_framework import viewsets
2426
from rest_framework.decorators import action
25-
from rest_framework.decorators import api_view
2627
from rest_framework.permissions import IsAdminUser
2728
from rest_framework.response import Response
2829

@@ -185,7 +186,7 @@ def update_status(self, request, *args, **kwargs):
185186
return Response(response, status=status.HTTP_400_BAD_REQUEST)
186187

187188

188-
@api_view(["POST"])
189+
@require_POST
189190
@csrf_exempt
190191
def index_package_scan(request, key):
191192
"""
@@ -229,4 +230,4 @@ def index_package_scan(request, key):
229230
"status": f"scan results for scannable_uri {scannable_uri.uuid} "
230231
"have been queued for indexing"
231232
}
232-
return Response(msg)
233+
return JsonResponse(msg)

0 commit comments

Comments
 (0)