• Luke Duncalfe's avatar
    Add migrations to limit Design filename · b423fe90
    Luke Duncalfe authored
    This change adds two post-migrations that enforce a character limit
    for design_management_designs.filename of 255.
    
    The first post-migration adds the limit to the filename column.
    
    The second post-migration modifies any design filenames larger than 255
    characters to the string "gitlab-modified-#{id}".
    
    This will ensure the filename remains valid (by having a valid image
    extension .jpg and being unique).
    
    Any records modified by this data migration will appear as a broken
    image when viewed within the GitLab app, as filenames are used to look
    up the design file from the design git repository.
    
    However, this is an intentional consequence given the 255 character
    limit was selected because that is the largest filename that most
    filesystems support, and also because GitLab.com has 6 records with
    filenames larger than this but they are all abuse.
    
    https://gitlab.com/gitlab-org/gitlab/-/issues/209025
    b423fe90
20200602013900_add_limit_to_designs_filename.rb 366 Bytes