aboutsummaryrefslogtreecommitdiffstats
path: root/mediagoblin/gmg_commands/addmedia.py
diff options
context:
space:
mode:
authorBerker Peksag <berker.peksag@gmail.com>2014-11-17 07:11:44 +0200
committerMatt Molyneaux <moggers87+git@moggers87.co.uk>2014-11-22 18:12:19 +0000
commit9d85dcdf11d3229625d1860a13db44d8d450347c (patch)
treeb4f7a8ce0cbe967800fa40e79a3f3948b3df7052 /mediagoblin/gmg_commands/addmedia.py
parent9c602458d830c1ebcd0ede7c14f7ddef79e2a73f (diff)
downloadmediagoblin-9d85dcdf11d3229625d1860a13db44d8d450347c.tar.lz
mediagoblin-9d85dcdf11d3229625d1860a13db44d8d450347c.tar.xz
mediagoblin-9d85dcdf11d3229625d1860a13db44d8d450347c.zip
Fix unicode handling in "gmg addmedia".
Diffstat (limited to 'mediagoblin/gmg_commands/addmedia.py')
-rw-r--r--mediagoblin/gmg_commands/addmedia.py7
1 files changed, 4 insertions, 3 deletions
diff --git a/mediagoblin/gmg_commands/addmedia.py b/mediagoblin/gmg_commands/addmedia.py
index b741b96f..2aa8f96a 100644
--- a/mediagoblin/gmg_commands/addmedia.py
+++ b/mediagoblin/gmg_commands/addmedia.py
@@ -88,14 +88,15 @@ def addmedia(args):
# this is kinda terrible
if some_string is None:
return None
- else:
- return six.text_type(some_string)
+ if six.PY2:
+ return six.text_type(some_string, 'utf-8')
+ return some_string
try:
submit_media(
mg_app=app,
user=user,
- submitted_file=open(abs_filename, 'r'), filename=filename,
+ submitted_file=open(abs_filename, 'rb'), filename=filename,
title=maybe_unicodeify(args.title),
description=maybe_unicodeify(args.description),
license=maybe_unicodeify(args.license),