Skip to content

Save media content with random names #699

Description

@pablodiegoss

Refactoring Proposal

Sometimes users upload content with special characters on the filename, which has and could cause problems while searching for the file using django admin or S3, leading to "file not found" errors when special characters are automatically escaped by S3 or Django.

Describe refactoring alternatives to redesign the code

  • Create a new field on models called "original_filename" to save the original filename in case its needed
  • Create a UUID name that is based on timestamp to avoid collisions and use that to save the media
  • Create a migration to rename all the objects in the current database with the same pattern of UUID.
  • Be careful to keep the extension on the end of the name, its used in multiple places

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions