gollum / rugged_adapter

Adapter to make gollum use Rugged (libgit2) at the backend.
MIT License
36 stars 27 forks source link

UTF8 directory name #23

Closed JianleiZhang closed 5 years ago

JianleiZhang commented 7 years ago

Dockerfile:

FROM ruby
RUN apt-get -y update && apt-get -y install libicu-dev cmake
RUN gem install gollum
RUN gem install github-markdown org-ruby gollum-rugged_adapter 
VOLUME /wiki
WORKDIR /wiki
CMD ["gollum", "--port", "80", "--adapter", "rugged", "--allow-uploads", "page"]
EXPOSE 80

when the directory name has UTF8 character,gollum has error:

http://192.168.2.188:4567/create/%E6%95%99%E7%A8%8B/44444 -> /javascript/editor/langs/markdown.js?_=1484796691146
[2017-01-19 11:32:30] ERROR URI::InvalidURIError: URI must be ascii only "http://192.168.2.188:4567/\u6559\u7A0B/44444"
        /usr/local/lib/ruby/2.4.0/uri/rfc3986_parser.rb:21:in `split'
        /usr/local/lib/ruby/2.4.0/uri/rfc3986_parser.rb:73:in `parse'
        /usr/local/lib/ruby/2.4.0/uri/rfc3986_parser.rb:117:in `convert_to_uri'
        /usr/local/lib/ruby/2.4.0/uri/generic.rb:1099:in `merge'
        /usr/local/lib/ruby/2.4.0/webrick/httpresponse.rb:277:in `setup_header'
        /usr/local/bundle/gems/rack-1.6.5/lib/rack/handler/webrick.rb:16:in `setup_header'
        /usr/local/lib/ruby/2.4.0/webrick/httpresponse.rb:207:in `send_response'
        /usr/local/lib/ruby/2.4.0/webrick/httpserver.rb:112:in `run'
        /usr/local/lib/ruby/2.4.0/webrick/server.rb:290:in `block in start_thread'
192.168.2.189 - - [19/Jan/2017:11:32:30 UTC] "POST /create HTTP/1.1" 303 0
http://192.168.2.188:4567/create/%E6%95%99%E7%A8%8B/44444 -> /create
192.168.2.189 - - [19/Jan/2017:11:32:33 UTC] "POST /create HTTP/1.1" 200 1547
http://192.168.2.188:4567/create/%E6%95%99%E7%A8%8B/44444 -> /create
JianleiZhang commented 7 years ago

file name has UTF8 character

http://192.168.2.188:4567/create/User/Jianlei%20Zhang/%E4%BA%91%E7%AD%BE%E5%88%B0 -> /javascript/editor/langs/markdown.js?_=1484813762714
[2017-01-19 16:19:21] ERROR URI::InvalidURIError: bad URI(is not URI?): http://192.168.2.188:4567/User/Jianlei Zhang/%E4%BA%91%E7%AD%BE%E5%88%B0
        /usr/local/lib/ruby/2.4.0/uri/rfc3986_parser.rb:67:in `split'
        /usr/local/lib/ruby/2.4.0/uri/rfc3986_parser.rb:73:in `parse'
        /usr/local/lib/ruby/2.4.0/uri/rfc3986_parser.rb:117:in `convert_to_uri'
        /usr/local/lib/ruby/2.4.0/uri/generic.rb:1099:in `merge'
        /usr/local/lib/ruby/2.4.0/webrick/httpresponse.rb:277:in `setup_header'
        /usr/local/bundle/gems/rack-1.6.5/lib/rack/handler/webrick.rb:16:in `setup_header'
        /usr/local/lib/ruby/2.4.0/webrick/httpresponse.rb:207:in `send_response'
        /usr/local/lib/ruby/2.4.0/webrick/httpserver.rb:112:in `run'
        /usr/local/lib/ruby/2.4.0/webrick/server.rb:290:in `block in start_thread'
192.168.2.189 - - [19/Jan/2017:16:19:21 UTC] "POST /create HTTP/1.1" 303 0
http://192.168.2.188:4567/create/User/Jianlei%20Zhang/%E4%BA%91%E7%AD%BE%E5%88%B0 -> /create
dometto commented 7 years ago

Thanks for the bug report. We need a uniform way of handling file encoding to prevent a bunch of encoding related bugs like this one.

dometto commented 5 years ago

@JianleiZhang can you see if this is fixed when using the 5.x branch of gollum? We've made improvements to UTF8 handling.

dometto commented 5 years ago

This is resolved in 5.x and the latest adapter.