Skip to content

WebIDE encode non-ASCII character with octal UTF-8

Summary

Open a file whose file name contains Chinese character in WebIDE and the file name will display as octal UTF-8 encoding.

Steps to reproduce

  1. Start a GitLab container with the image: gitlab/gitlab-ce:10.8.4-ce.0
  2. Create a new project and create a new file with Chinese file name
  3. Open WebIDE and you'll find there is a weird file name in the left sidebar

Example Project

This is the weird part. When I try to reproduce it in GitLab.com, it works properly.
Even if I start a GitLab container with the same image as GitLab.com, which is 11.0.0-rc10-ee, it's still not working.
You may try in this project and this one would work properly.
Maybe there is something I have to configure but I can't find it.

What is the current bug behavior?

The file which contains Chinese character will be displayed in octal UTF-8 encoding.
When I click the file in WebIDE, it want to access the file whose path is http://OMIT-GITLAB-URL/"\351\200\231\346\230\257....md which causes the 404.

Given a file with name: 中文.md (which means Chinese.md) and the corresponding UTF-8 encoding is: %E4%B8%AD%E6%96%87.md and in octal: 344 270 255 346 226 207.
WebIDE display it with double quotes: "\344\270\255\346\226\207.md" and I click the file, it send a request with encoding the file name in octal UTF-8: %22%5C344%5C270%5C255%5C346%5C226%5C207.md%22.

Here is the whole flow I'd found: 中文.md -> encode in octal UTF-8 -> "\344\270\255\346\226\207.md" -> encode in hex UTF-8 -> %22%5C344%5C270%5C255%5C346%5C226%5C207.md%22 -> file not found.
I guess it's probably git encode problem but I'm not sure where exactly the related code are.

Screen_Shot_2018-06-13_at_15.14.37

What is the expected correct behavior?

It should display Chinese file name and send request with normal URL encoding.
Screen_Shot_2018-06-14_at_09.51.25

Relevant logs and/or screenshots

  1. A file contains Chinese character
    Screen_Shot_2018-06-13_at_15.13.14

  2. Content can contain Chinese
    Screen_Shot_2018-06-13_at_15.13.45

  3. File name in octal UTF-8 encoding
    Screen_Shot_2018-06-13_at_15.14.29

Output of checks

My GitLab runs in Docker container and I think the Docker image install GitLab from omnibus package.

Results of GitLab environment info

Expand for output related to GitLab environment info

System information System: Current User: git Using RVM: no Ruby Version: 2.3.7p456 Gem Version: 2.6.14 Bundler Version:1.13.7 Rake Version: 12.3.1 Redis Version: 3.2.11 Git Version: 2.16.4 Sidekiq Version:5.0.5 Go Version: unknown

GitLab information Version: 10.8.4 Revision: 2268d0c Directory: /opt/gitlab/embedded/service/gitlab-rails DB Adapter: postgresql URL: http://kai-desktop.local.bridgewell.com:10080 HTTP Clone URL: http://kai-desktop.local.bridgewell.com:10080/some-group/some-project.git SSH Clone URL: ssh://git@kai-desktop.local.bridgewell.com:10022/some-group/some-project.git Using LDAP: no Using Omniauth: no

GitLab Shell Version: 7.1.2 Repository storage paths:

  • default: /var/opt/gitlab/git-data/repositories Hooks: /opt/gitlab/embedded/service/gitlab-shell/hooks Git: /opt/gitlab/embedded/bin/git

Results of GitLab application Check

Expand for output related to the GitLab application check

Possible fixes

This is the MR I can find the most related:
https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/18404

Edited by Chih Kai Yu