Skip to content

download_results_csv uses slugify without null-check on rnd.name #542

@ayushshukla1807

Description

@ayushshukla1807

Problem

In admin_endpoints.py, download_results_csv calls:

output_name = 'montage_results-%s-%s.csv' % (slugify(rnd.name, ascii=True).decode('ascii'), now)

If rnd.name is None (which is theoretically possible if a round was created with a missing name before validation was enforced), slugify(None, ...) will raise an AttributeError.

The same pattern exists in download_round_entries_csv, which was fixed in #531. This endpoint has the same latent bug.

Suggested Fix

Add a null-guard:

round_name = rnd.name or 'unnamed-round'
output_name = 'montage_results-%s-%s.csv' % (slugify(round_name, ascii=True).decode('ascii'), now)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions