!72 Fix: Multipart file uploads with empty filename not detected as binary.

From: @zhang-liang-pengkun 
Reviewed-by: @Charlie_li 
Signed-off-by: @Charlie_li
This commit is contained in:
openeuler-ci-bot 2024-01-05 09:38:10 +00:00 committed by Gitee
commit 9dd9fc2d0b
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
2 changed files with 37 additions and 1 deletions

View File

@ -0,0 +1,32 @@
From ed32f36b3feb8bbf1edaed4875b9820c9a71792e Mon Sep 17 00:00:00 2001
From: Marcel Hellkamp <marc@gsites.de>
Date: Wed, 7 Jul 2021 13:02:33 +0200
Subject: [PATCH] Fix: Multipart file uploads with empty filename not detected
as binary.
---
bottle.py | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/bottle.py b/bottle.py
index 9806efd..406762f 100644
--- a/bottle.py
+++ b/bottle.py
@@ -1239,11 +1239,11 @@ class BaseRequest(object):
self['_cgi.FieldStorage'] = data #http://bugs.python.org/issue18394#msg207958
data = data.list or []
for item in data:
- if item.filename:
+ if item.filename is None:
+ post[item.name] = item.value
+ else:
post[item.name] = FileUpload(item.file, item.name,
item.filename, item.headers)
- else:
- post[item.name] = item.value
return post
@property
--
2.39.0.windows.2

View File

@ -1,6 +1,6 @@
Name: python-bottle Name: python-bottle
Version: 0.12.13 Version: 0.12.13
Release: 16 Release: 17
Summary: WSGI micro web-framework for Python. Summary: WSGI micro web-framework for Python.
License: MIT License: MIT
URL: http://bottlepy.org URL: http://bottlepy.org
@ -15,6 +15,7 @@ Patch0005: 0004-fix-1115-Some-modules-set-__file__-as-None.patch
Patch0006: 0005-fix-1148-redirect-and-non-ascii-characters.patch Patch0006: 0005-fix-1148-redirect-and-non-ascii-characters.patch
Patch0007: 0006-1177-Bug-fix-of-missing-regex-escaped-back-slashes.patch Patch0007: 0006-1177-Bug-fix-of-missing-regex-escaped-back-slashes.patch
Patch0008: 0007-Fix-the-Allow-header-value-in-405-Method-not-allowed.patch Patch0008: 0007-Fix-the-Allow-header-value-in-405-Method-not-allowed.patch
Patch0009: 0008-Fix-Multipart-file-uploads-with-empty-filename-not-d.patch
BuildArch: noarch BuildArch: noarch
BuildRequires: python2-devel python2-setuptools python3-devel python3-setuptools BuildRequires: python2-devel python2-setuptools python3-devel python3-setuptools
@ -69,6 +70,9 @@ sed -i '/^#!/d' bottle.py
%{python3_sitelib}/* %{python3_sitelib}/*
%changelog %changelog
* Fri Jan 05 2024 zhangliangpengkun<zhangliangpengkun@xfusion.com> - 0.12.13-17
- Fix: Multipart file uploads with empty filename not detected as binary.
* Fri Dec 29 2023 zhangliangpengkun<zhangliangpengkun@xfusion.com> - 0.12.13-16 * Fri Dec 29 2023 zhangliangpengkun<zhangliangpengkun@xfusion.com> - 0.12.13-16
- Fix the Allow: header value in 405 "Method not allowed." response. - Fix the Allow: header value in 405 "Method not allowed." response.