Skip to content

Commit

Permalink
Improve validation of a value taken directly from a GET.
Browse files Browse the repository at this point in the history
  • Loading branch information
rjsparks committed Feb 19, 2020
1 parent 6013e06 commit a1f7609
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions ietf/blog/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

from django.db import models
from django.db.models.functions import Coalesce
from django.http import Http404
from django.shortcuts import redirect, get_object_or_404
from django.core.exceptions import ObjectDoesNotExist
from django.utils import functional
Expand Down Expand Up @@ -279,6 +280,10 @@ def serve(self, request, *args, **kwargs):
if not topic_id:
topic_id = request.GET.get('secondary_topic') # For legacy URI support
if topic_id:
try:
topic_id = int(topic_id)
except ValueError:
raise Http404
filter_topic = get_object_or_404(Topic,id=topic_id)
query_string_segments=[]
for parameter, function in parameter_functions_map.items():
Expand Down

0 comments on commit a1f7609

Please sign in to comment.