Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

fix for uploads files with long name #62

Merged
merged 2 commits into from

2 participants

@vladyslav2

just add max_length = 255 to file filed.

@benjaoming benjaoming merged commit 4e2ced2 into from
@benjaoming
Owner

Thanks! I was hoping that the deafults of FileField were sane. 255 is the max length on fat32, so it's probably a fine max.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
This page is out of date. Refresh to see the latest.
Showing with 2 additions and 1 deletion.
  1. +1 −1  wiki/core/http.py
  2. +1 −0  wiki/plugins/attachments/models.py
View
2  wiki/core/http.py
@@ -32,6 +32,6 @@ def send_file(request, filepath, last_modified=None, filename=None):
# TODO: Escape filename
if filename:
- response["Content-Disposition"] = "attachment; filename=%s" % filename
+ response["Content-Disposition"] = "attachment; filename=%s" % filename.encode('utf-8')
return response
View
1  wiki/plugins/attachments/models.py
@@ -76,6 +76,7 @@ class AttachmentRevision(BaseRevisionMixin, models.Model):
attachment = models.ForeignKey('Attachment')
file = models.FileField(upload_to=upload_path, #@ReservedAssignment
+ max_length=255,
verbose_name=_(u'file'),
storage=settings.STORAGE_BACKEND)
Something went wrong with that request. Please try again.