diff --git a/core/views/expo.py b/core/views/expo.py index 8d67f6f..5f4e2b3 100644 --- a/core/views/expo.py +++ b/core/views/expo.py @@ -341,13 +341,14 @@ def editexpopage(request, path): return render(request,'errors/generic.html', {'message': message}) try: - cp_add = subprocess.run([git, "add", filename.encode(sysdefaultencoding)], cwd=cwd, capture_output=True, text=True) + encoded_filename = filename.encode(sysdefaultencoding) + cp_add = subprocess.run([git, "add", encoded_filename], cwd=cwd, capture_output=True, text=True) if cp_add.returncode != 0: msgdata = 'Ask a nerd to fix this.\n\n' + cp_add.stderr + '\n\n' + cp_add.stdout + '\n\nreturn code: ' + str(cp_add.returncode) message = f'CANNOT git on server for this file {filename}. Edits saved but not added to git.\n\n' + msgdata return render(request,'errors/generic.html', {'message': message}) - - cp_commit = subprocess.run([git, "commit", "-m", f'Troggle online: Edit this page - {filename}'], cwd=cwd, capture_output=True, text=True) + + cp_commit = subprocess.run([git, "commit", "-m", f'Troggle online: Edit this page - {encoded_filename}'], cwd=cwd, capture_output=True, text=True) # This produces return code = 1 if it commits OK, but when the repo still needs to be pushed to origin/expoweb if cp_commit.returncode != 0 and cp_commit.stdout != 'nothing to commit, working tree clean': msgdata = 'Ask a nerd to fix this.\n\n' + cp_commit.stderr + '\n\n' + cp_commit.stdout + '\n\nreturn code: ' + str(cp_commit.returncode)