You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hello!
By default Django models.FileField is limited to 100 chars.
In some cases this limit is too small for payload fields in Mdn and Message tables.
This cause problems with long filenames (update query fails and field left blank) and prevent normal message/mdn view and mdn sending:
ValueError: The 'payload' attribute has no file associated with it.
Internal Server Error: /admin/pyas2/mdn/290276/change/
Sending all pending asynchronous MDNs
Traceback (most recent call last):
File "/var/www/pyas2/manage.py", line 22, in
main()
File "/var/www/pyas2/manage.py", line 18, in main
execute_from_command_line(sys.argv)
File "/opt/pyvenv/as2/lib64/python3.6/site-packages/django/core/management/init.py", line 419, in execute_from_command_line
utility.execute()
File "/opt/pyvenv/as2/lib64/python3.6/site-packages/django/core/management/init.py", line 413, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "/opt/pyvenv/as2/lib64/python3.6/site-packages/django/core/management/base.py", line 354, in run_from_argv
self.execute(*args, **cmd_options)
File "/opt/pyvenv/as2/lib64/python3.6/site-packages/django/core/management/base.py", line 398, in execute
output = self.handle(*args, **options)
File "/opt/pyvenv/as2/lib64/python3.6/site-packages/pyas2/management/commands/manageas2server.py", line 125, in handle
data=pending_mdn.payload.read(),
File "/opt/pyvenv/as2/lib64/python3.6/site-packages/django/core/files/utils.py", line 42, in
read = property(lambda self: self.file.read)
File "/opt/pyvenv/as2/lib64/python3.6/site-packages/django/db/models/fields/files.py", line 43, in _get_file
self._require_file()
File "/opt/pyvenv/as2/lib64/python3.6/site-packages/django/db/models/fields/files.py", line 40, in _require_file
raise ValueError("The '%s' attribute has no file associated with it." % self.field.name)
ValueError: The 'payload' attribute has no file associated with it.
Seems like maximum full path length on various filesystems is about 4096 characters.
I propose to set max_length for payload fields in pyas2/models.py to 4096 like this:
Hello!
By default Django models.FileField is limited to 100 chars.
In some cases this limit is too small for payload fields in Mdn and Message tables.
This cause problems with long filenames (update query fails and field left blank) and prevent normal message/mdn view and mdn sending:
Seems like maximum full path length on various filesystems is about 4096 characters.
I propose to set max_length for payload fields in pyas2/models.py to 4096 like this:
payload = models.FileField(upload_to=get_mdn_store, null=True, blank=True, max_length=4096)
payload = models.FileField(upload_to=get_message_store, null=True, blank=True, max_length=4096)
The text was updated successfully, but these errors were encountered: