Try matching
This commit is contained in:
parent
80b722e677
commit
ff5dfc1489
@ -1,5 +1,6 @@
|
|||||||
from typing import Dict, Optional, Tuple
|
from typing import Dict, Optional, Tuple
|
||||||
|
|
||||||
|
import re
|
||||||
import multipart
|
import multipart
|
||||||
|
|
||||||
class Part:
|
class Part:
|
||||||
@ -88,20 +89,24 @@ def get_body_from_form_data(
|
|||||||
headers: Dict[str, str] = {}
|
headers: Dict[str, str] = {}
|
||||||
|
|
||||||
for part in parts:
|
for part in parts:
|
||||||
if data is None:
|
for header in part.headers:
|
||||||
for header in part.headers:
|
print("YO CHECKING ", header.value)
|
||||||
print("YO CHECKING ", header.value)
|
if b'name="upload_file"' in header.value:
|
||||||
if b'name="upload_file"' in header.value:
|
headers["key"] = "upload_file"
|
||||||
headers["key"] = "upload_file"
|
data = part.data
|
||||||
|
print("YO SET UPLOAD FILE")
|
||||||
|
else:
|
||||||
|
if b'name="file"' in header.value:
|
||||||
data = part.data
|
data = part.data
|
||||||
print("YO SET UPLOAD FILE")
|
print("YO SETTING FILE")
|
||||||
else:
|
else:
|
||||||
if b'name="file"' in header.value:
|
match = re.search(r'name="([^"]*)"', header.value)
|
||||||
data = part.data
|
if match:
|
||||||
print("YO SETTING FILE")
|
name = match.group(1)
|
||||||
else:
|
print("YO GOT NAME", name)
|
||||||
headers["file"] = part.data.decode("utf-8")
|
headers[name] = part.data.decode("utf-8")
|
||||||
print("YO COPING OUT")
|
print("YO AYY")
|
||||||
|
print("YO COPING OUT")
|
||||||
|
|
||||||
# name="x-amz-algorithm"', b'Content-Disposition':b'form-data; name="x-amz-credential"', b'Content-Disposition':b'form-data; name="x-amz-date"', b'Content-Disposition':b'form-data; name="policy"', b'Content-Disposition':b'form-data; name="x-amz-signature"', b'Content-Disposition':b'form-data; name="file"; filename="/run/user/1001/tmpi1gf2n_j/test_local_file.txt"'],
|
# name="x-amz-algorithm"', b'Content-Disposition':b'form-data; name="x-amz-credential"', b'Content-Disposition':b'form-data; name="x-amz-date"', b'Content-Disposition':b'form-data; name="policy"', b'Content-Disposition':b'form-data; name="x-amz-signature"', b'Content-Disposition':b'form-data; name="file"; filename="/run/user/1001/tmpi1gf2n_j/test_local_file.txt"'],
|
||||||
# for prt in parser.parts():
|
# for prt in parser.parts():
|
||||||
|
Loading…
Reference in New Issue
Block a user