SmileyChris / easy-thumbnails

Easy thumbnails for Django
http://easy-thumbnails.readthedocs.org/
BSD 3-Clause "New" or "Revised" License
1.38k stars 318 forks source link

Increase File name field length #624

Open petrklus opened 1 year ago

petrklus commented 1 year ago

For our use-case, we have found that the 255 character limit is not enough to contain large file names + thumbnail prefix folder structure.

I therefore suggest increasing the limit here:

https://github.com/SmileyChris/easy-thumbnails/blob/master/easy_thumbnails/models.py#L55

We have temporarily mitigated the issue with a migration patching the table directly, though it would be great to have a permanent solution.

I think that 4096 should be enough to contain even the longest prefixes alongside the 255/7 file name length max.

from django.db import migrations

class Migration(migrations.Migration):

    dependencies = [
        ...
    ]

    operations = [
        migrations.RunSQL(
            "ALTER TABLE easy_thumbnails_thumbnail ALTER COLUMN name TYPE varchar(4096);"),
        migrations.RunSQL(
            "ALTER TABLE easy_thumbnails_source ALTER COLUMN name TYPE varchar(4096);")
    ]
petrklus commented 11 months ago

@SmileyChris / @jrief any thoughts on this?