mirror of https://gitlab.com/bashrc2/epicyon
utf8 encoding
parent
95a11cccbb
commit
3bd0646c6c
|
@ -396,7 +396,7 @@ def extractMediaInFormPOST(postBytes,boundary,name: str):
|
||||||
"""Extracts the binary encoding for image/video/audio within a http form POST
|
"""Extracts the binary encoding for image/video/audio within a http form POST
|
||||||
Returns the media bytes and the remaining bytes
|
Returns the media bytes and the remaining bytes
|
||||||
"""
|
"""
|
||||||
imageStartBoundary=b'Content-Disposition: form-data; name="'+unicode(name,"utf-8")+b'";'
|
imageStartBoundary=b'Content-Disposition: form-data; name="'+name.encode('utf8', 'ignore')+b'";'
|
||||||
imageStartLocation=postBytes.find(imageStartBoundary)
|
imageStartLocation=postBytes.find(imageStartBoundary)
|
||||||
if imageStartLocation==-1:
|
if imageStartLocation==-1:
|
||||||
return None,postBytes
|
return None,postBytes
|
||||||
|
@ -447,7 +447,7 @@ def saveMediaInFormPOST(mediaBytes,baseDir: str, \
|
||||||
'ogg': 'audio/ogg'
|
'ogg': 'audio/ogg'
|
||||||
}
|
}
|
||||||
for extension,contentType in extensionList.items():
|
for extension,contentType in extensionList.items():
|
||||||
searchStr=b'Content-Type: '+unicode(contentType,'utf-8')
|
searchStr=b'Content-Type: '+contentType.encode('utf8', 'ignore')
|
||||||
mediaLocation=mediaBytes.find(searchStr)
|
mediaLocation=mediaBytes.find(searchStr)
|
||||||
if not filenameBase:
|
if not filenameBase:
|
||||||
filenameBase= \
|
filenameBase= \
|
||||||
|
|
Loading…
Reference in New Issue