Trac is being migrated to new services! Issues can be found in our new
YouTrack instance and WIKI pages can be found on our
website.
LocalTracChanges: attachment_filename_restrict.patch
File attachment_filename_restrict.patch, 542 bytes (added by datallah, 15 years ago) |
Hack to restrict filenames so that they don't need to be URL-escaped
|
-
old
|
new
|
|
572 | 572 | 'utf-8')) |
573 | 573 | filename = filename.replace('\\', '/').replace(':', '/') |
574 | 574 | filename = os.path.basename(filename) |
| 575 | p = re.compile("[^0-9a-zA-Z.,\-_]") |
| 576 | filename = p.sub('_', filename) |
575 | 577 | if not filename: |
576 | 578 | raise TracError(_('No file uploaded')) |
577 | 579 | # Now the filename is known, update the attachment resource |
Download in other formats:
All information, including names and email addresses, entered onto this website or sent to mailing lists affiliated with this website will be public. Do not post confidential information, especially passwords!