Skip to content

Store original uploaded filename and show it (admin-only) for talks/posters/publications #1391

Description

@jonfroehlich

Summary

When an editor uploads a talk/poster/publication file, Artifact.save() renames it to the standardized Author_TitleInTitleCase_VenueYear scheme, destroying the original upload name (e.g. MyTalk_v3_final_FORPDF.pptx). Consider storing that original filename and surfacing it read-only in admin only so editors have a provenance breadcrumb to confirm which file they actually uploaded.

Spun out of a discussion on #1097 / #1390.

Motivation

  • The rename strips the one human-recognizable clue in the filename (v3_final, etc.). Storing it back is useful for provenance and for debugging mis-uploads after the fact.
  • Admin-only display, e.g. a read-only row on the change form: Originally uploaded as: MyTalk_v3_final.pptx.

Important framing — this is the weaker of two solutions

The real "did I upload the right file?" question is better answered by seeing the file (the planned admin thumbnail preview on the Talk/Poster/Pub change form), not by reading a name. So:

  • If the goal is "editor verifies the right file" → prioritize the thumbnail preview; treat this as a complementary nice-to-have.
  • If the goal is forensic/provenance (tracing mis-uploads later) → this stands alone fine.

Design notes

  • Field: one nullable CharField (e.g. original_pdf_filename / original_raw_filename, or a single field per file as needed) on the Artifact abstract base → one definition, three tables, one migration.
  • Admin-only: never expose publicly (DB column + readonly_fields on the change form). Consistent with the "never write sensitive data to web-served paths" rule — this is admin-surface only.
  • Forward-only: existing rows can't be backfilled (the original name is already gone), so historical artifacts show blank. Expected.
  • Capture point (the only tricky part): the auto-rename runs on every qualifying save, not just on upload, so we can't unconditionally snapshot "basename before rename" (on a later edit that's already the standardized name). Capture the original only when the file field actually changed. Artifact.save() already fetches the prior instance (orig_artifact, used to delete the old raw_file) — piggyback on that diff to detect a genuine new upload.

Scope / risk

  • Low risk: additive nullable field, admin-only display, no public/URL impact.
  • Main cost is getting the new-upload-vs-edit detection right in the already-delicate save() method.

Labels: schema change (Requires Updating Model Database).

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions