Commit 1bec3073 authored by Nicolas Wavrant's avatar Nicolas Wavrant

runner: user's git information can now contain utf-8 characters

parent 89ad1d9e
Pipeline #3909 skipped
......@@ -39,7 +39,7 @@ def updateGitConfig(repository, user, email):
repo = Repo(repository)
config_writer = repo.config_writer()
if user != "":
config_writer.set_value("user", "name", user.encode("utf-8"))
config_writer.set_value("user", "name", user)
if email != "":
config_writer.set_value("user", "email", email)
config_writer.release()
......
......@@ -118,7 +118,7 @@ def manageRepository():
git_user_path = os.path.join(app.config['etc_dir'], '.git_user')
name = email = ""
if os.path.exists(git_user_path):
with open(git_user_path, 'r') as gfile:
with codecs.open(git_user_path, 'r', encoding='utf-8') as gfile:
name, email = gfile.read().split(';')
return render_template('manageRepository.html', workDir='workspace',
project=listFolder(app.config, 'workspace'),
......@@ -633,8 +633,9 @@ def updateAccount():
updateGitConfig(app.config['default_repository_path'], name, email)
except GitCommandError, e:
return jsonify(code=0, result=str(e))
with open(os.path.join(app.config['etc_dir'], '.git_user'), 'w') as gfile:
gfile.write('%s;%s' % (name, email))
git_user_file = os.path.join(app.config['etc_dir'], '.git_user')
with codecs.open(git_user_file, 'w', encoding='utf-8') as gfile:
gfile.write(u'{};{}'.format(name, email))
return jsonify(code=1, result="")
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment