Skip to content

Commit

Permalink
Allow filenames with non-ascii characters
Browse files Browse the repository at this point in the history
This encodes the filenames from `git status` to utf-8. With this change the filenames are properly displayed in the UI and git commands such as add, and push still function as expected as git can accept filenames in utf-8 encoding because "Git is to some extent character encoding agnostic." see: https://git-scm.com/docs/git-commit/2.13.4#_discussion
  • Loading branch information
ianhi committed Mar 4, 2020
1 parent 0d71ee3 commit 6f4d215
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions jupyterlab_git/git.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import re
import subprocess
from urllib.parse import unquote
from codecs import decode, escape_decode

import pexpect
import tornado
Expand Down Expand Up @@ -262,6 +263,8 @@ async def status(self, current_path):
to1 = to1[1:]
if to1.endswith('"'):
to1 = to1[:-1]
to1 = decode(escape_decode(to1)[0],'utf-8')
from_path = decode(escape_decode(from_path)[0],'utf-8')
result.append({"x": line[0], "y": line[1], "to": to1, "from": from_path})
return {"code": code, "files": result}

Expand Down

0 comments on commit 6f4d215

Please sign in to comment.