Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
G
golang
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
go
golang
Commits
f31bc223
Commit
f31bc223
authored
Nov 06, 2009
by
Russ Cox
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix UTF-8 upload bug
TBR=r
http://go/go-review/1026001
parent
0ea9dd81
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
4 deletions
+7
-4
codereview.py
lib/codereview/codereview.py
+7
-4
No files found.
lib/codereview/codereview.py
View file @
f31bc223
...
@@ -36,9 +36,6 @@ For example, if change 123456 contains the files x.go and y.go,
...
@@ -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):
...
@@ -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):
...
@@ -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
):
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment