Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
View | Details | Raw Unified | Return to bug 139976
Collapse All | Expand All

(-)Scrubber.py.orig (-4 / +20 lines)
Lines 266-272 Link Here
266
            finally:
266
            finally:
267
                os.umask(omask)
267
                os.umask(omask)
268
            desc = part.get('content-description', _('not available'))
268
            desc = part.get('content-description', _('not available'))
269
            filename = part.get_filename(_('not available'))
269
            try:
270
                filename = part.get_filename(_('not available'))
271
            except ValueError:
272
                # Hack to deal with filename containing ' character.
273
                filename = _('not available')
270
            del part['content-type']
274
            del part['content-type']
271
            del part['content-transfer-encoding']
275
            del part['content-transfer-encoding']
272
            part.set_payload(_("""\
276
            part.set_payload(_("""\
Lines 358-365 Link Here
358
    # e.g. image/jpg (should be image/jpeg).  For now we just store such
362
    # e.g. image/jpg (should be image/jpeg).  For now we just store such
359
    # things as application/octet-streams since that seems the safest.
363
    # things as application/octet-streams since that seems the safest.
360
    ctype = msg.get_content_type()
364
    ctype = msg.get_content_type()
361
    fnext = os.path.splitext(msg.get_filename(''))[1]
365
    try:
362
    ext = guess_extension(ctype, fnext)
366
        fnext = os.path.splitext(msg.get_filename(''))[1]
367
    except ValueError:
368
        # Catch the case when msg.get_filename('') fails with a
369
        # ValueError: need more than 2 values to unpack
370
        # File "/usr/lib/python2.4/email/Utils.py", line 222, in decode_rfc2231
371
        #   charset, language, s = parts
372
        ext = ''
373
    else:
374
        ext = guess_extension(ctype, fnext)
363
    if not ext:
375
    if not ext:
364
        # We don't know what it is, so assume it's just a shapeless
376
        # We don't know what it is, so assume it's just a shapeless
365
        # application/octet-stream, unless the Content-Type: is
377
        # application/octet-stream, unless the Content-Type: is
Lines 377-383 Link Here
377
    try:
389
    try:
378
        # Now base the filename on what's in the attachment, uniquifying it if
390
        # Now base the filename on what's in the attachment, uniquifying it if
379
        # necessary.
391
        # necessary.
380
        filename = msg.get_filename()
392
        try:
393
            filename = msg.get_filename()
394
        except ValueError:
395
            # Another case of catching filenames that contain a ' character.
396
            filename = ''
381
        if not filename:
397
        if not filename:
382
            filebase = 'attachment'
398
            filebase = 'attachment'
383
        else:
399
        else:

Return to bug 139976