mirror of
git://git.yoctoproject.org/layerindex-web.git
synced 2025-07-19 12:49:01 +02:00
Improve handling of invalid branch in layer CSV export view
On layers.openembedded.org we're seeing requests from some search engine crawlers requesting the CSV export URL with an invalid branch for the layer. I couldn't see the referer anywhere in the logs but I suspect it has to do with some recent cleanup work I did in the database where I deleted some invalid LayerBranch records - they were probably following links in a cached version of the webpage. In any event we want to return 404 in this situation rather than an internal server error. Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
This commit is contained in:
parent
a7820077b0
commit
f76e811403
|
@ -1323,6 +1323,8 @@ def layer_export_recipes_csv_view(request, branch, slug):
|
|||
import csv
|
||||
layer = get_object_or_404(LayerItem, name=slug)
|
||||
layerbranch = layer.get_layerbranch(branch)
|
||||
if not layerbranch:
|
||||
raise Http404
|
||||
|
||||
response = HttpResponse(content_type='text/csv')
|
||||
response['Content-Disposition'] = 'attachment; filename="recipes_%s_%s.csv"' % (layer.name, layerbranch.branch.name)
|
||||
|
|
Loading…
Reference in New Issue
Block a user