mirror of
https://github.com/golang/go.git
synced 2025-11-08 12:41:02 +00:00
parent
0ea9dd815a
commit
f31bc223b3
1 changed files with 7 additions and 4 deletions
|
|
@ -36,9 +36,6 @@ For example, if change 123456 contains the files x.go and y.go,
|
||||||
"hg diff @123456" is equivalent to"hg diff x.go y.go".
|
"hg diff @123456" is equivalent to"hg diff x.go y.go".
|
||||||
'''
|
'''
|
||||||
|
|
||||||
# TODO(rsc):
|
|
||||||
# fix utf-8 upload bug
|
|
||||||
|
|
||||||
from mercurial import cmdutil, commands, hg, util, error, match
|
from mercurial import cmdutil, commands, hg, util, error, match
|
||||||
from mercurial.node import nullrev, hex, nullid, short
|
from mercurial.node import nullrev, hex, nullid, short
|
||||||
import os, re
|
import os, re
|
||||||
|
|
@ -2087,8 +2084,14 @@ def EncodeMultipartFormData(fields, files):
|
||||||
lines.append('--' + BOUNDARY)
|
lines.append('--' + BOUNDARY)
|
||||||
lines.append('Content-Disposition: form-data; name="%s"' % key)
|
lines.append('Content-Disposition: form-data; name="%s"' % key)
|
||||||
lines.append('')
|
lines.append('')
|
||||||
|
if type(value) == str:
|
||||||
|
value = value.decode("utf-8")
|
||||||
lines.append(value)
|
lines.append(value)
|
||||||
for (key, filename, value) in files:
|
for (key, filename, value) in files:
|
||||||
|
if type(filename) == str:
|
||||||
|
filename = filename.decode("utf-8")
|
||||||
|
if type(value) == str:
|
||||||
|
value = value.decode("utf-8")
|
||||||
lines.append('--' + BOUNDARY)
|
lines.append('--' + BOUNDARY)
|
||||||
lines.append('Content-Disposition: form-data; name="%s"; filename="%s"' %
|
lines.append('Content-Disposition: form-data; name="%s"; filename="%s"' %
|
||||||
(key, filename))
|
(key, filename))
|
||||||
|
|
@ -2099,7 +2102,7 @@ def EncodeMultipartFormData(fields, files):
|
||||||
lines.append('')
|
lines.append('')
|
||||||
body = CRLF.join(lines)
|
body = CRLF.join(lines)
|
||||||
content_type = 'multipart/form-data; boundary=%s' % BOUNDARY
|
content_type = 'multipart/form-data; boundary=%s' % BOUNDARY
|
||||||
return content_type, body
|
return content_type, body.encode("utf-8")
|
||||||
|
|
||||||
|
|
||||||
def GetContentType(filename):
|
def GetContentType(filename):
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue