I was not aware of this limit. In gluon/sql.py you should replace: newfilename = newfilename[:500] + '.' + extension
with something like newfilename = newfilename[:120] + '.' + extension perhaps this should be the default? Massimo On Apr 19, 5:16 pm, Rowdy <[email protected]> wrote: > Greetings, > > I am (still) using 1.76.5, running under Ubuntu 7.10. > > During file upload (whether from a form or as part of a cron job that > extract files attached to emails) I am finding that some long filenames > are causing the store() function to choke: > > Traceback (most recent call last): > File "applications/webacc2/cron/hlpcheck2.py", line 881, in <module> > Main() > File "applications/webacc2/cron/hlpcheck2.py", line 864, in Main > Process1(s, msgId) > File "applications/webacc2/cron/hlpcheck2.py", line 730, in Process1 > AttachToIncident(incidentId, tmpname, tmpdir2, hasAttachment, > attachDesc, from1, to1, subject, date1, originatorId) > File "applications/webacc2/cron/hlpcheck2.py", line 446, in > AttachToIncident > AddAttachment(IncidentId, inname, None, None, None, None, UserId) > File "applications/webacc2/cron/hlpcheck2.py", line 432, in AddAttachment > file = db.attachment.file.store(open(FileName, 'rb')), \ > File "/home/rowdy/web2py/gluon/sql.py", line 2645, in store > dest_file = open(pathfilename, 'wb') > IOError: [Errno 36] File name too long: > 'applications/webacc2/uploads/371041/attachment.file.8933d60f0092f7d3.696e667261456e74657270726973652045787465726e616c2043616c6c20526571756972696e6720416374696f6e203131373238392020204442202020496e66726150726f642020203130333735202020696d62616c616e6365206265747765656e2027524527262755502720474c205472616e73616374696f6e7320616e642072656365697074732e656d6c.eml' > > I have no control over the filenames submitted by the users, and this is > an operating system limit (i.e. I cannot touch the file to create it - > same error). > > Is there a best practice for dealing with this? > > The original filename is 141 characters in length which is well within > OS limits, but encoded and expanded by web2py comes out at 319 > characters. > > I suppose the users do not really need to see such long filenames when > downloading the files later on, so I could probably truncate the > original filename (and rename the original file) before inserting it > into the database. > > Any other ideas? > > Thanx > > Rowdy > > -- > Subscription settings:http://groups.google.com/group/web2py/subscribe?hl=en

