Try matching
This commit is contained in:
parent
80b722e677
commit
ff5dfc1489
@ -1,5 +1,6 @@
|
||||
from typing import Dict, Optional, Tuple
|
||||
|
||||
import re
|
||||
import multipart
|
||||
|
||||
class Part:
|
||||
@ -88,20 +89,24 @@ def get_body_from_form_data(
|
||||
headers: Dict[str, str] = {}
|
||||
|
||||
for part in parts:
|
||||
if data is None:
|
||||
for header in part.headers:
|
||||
print("YO CHECKING ", header.value)
|
||||
if b'name="upload_file"' in header.value:
|
||||
headers["key"] = "upload_file"
|
||||
for header in part.headers:
|
||||
print("YO CHECKING ", header.value)
|
||||
if b'name="upload_file"' in header.value:
|
||||
headers["key"] = "upload_file"
|
||||
data = part.data
|
||||
print("YO SET UPLOAD FILE")
|
||||
else:
|
||||
if b'name="file"' in header.value:
|
||||
data = part.data
|
||||
print("YO SET UPLOAD FILE")
|
||||
print("YO SETTING FILE")
|
||||
else:
|
||||
if b'name="file"' in header.value:
|
||||
data = part.data
|
||||
print("YO SETTING FILE")
|
||||
else:
|
||||
headers["file"] = part.data.decode("utf-8")
|
||||
print("YO COPING OUT")
|
||||
match = re.search(r'name="([^"]*)"', header.value)
|
||||
if match:
|
||||
name = match.group(1)
|
||||
print("YO GOT NAME", name)
|
||||
headers[name] = part.data.decode("utf-8")
|
||||
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"'],
|
||||
# for prt in parser.parts():
|
||||
|
Loading…
Reference in New Issue
Block a user