Skip to content

Encoding::CompatibilityError on page creation with template #1626

@treiher

Description

@treiher

Describe the bug
An encoding error is shown when a new page is created, which contains a non-ASCII character in its name, and a template is present, which also contains a non-ASCII character.

To Reproduce
The issue only occurs, if --template-page is enabled.

  1. Click on New
  2. Enter _Template.md as page name
  3. Click on OK
  4. Enter non-ASCII character (e.g., Ü) as content
  5. Click on Save
  6. Click on New
  7. Enter page name with non-ASCII character (e.g., Ü`)
  8. Click on OK
  9. The following error is shown:
Encoding::CompatibilityError at /gollum/create/%C3%9C
incompatible character encodings: UTF-8 and ASCII-8BIT
file: template.rb location: render line: 39
BACKTRACE
(expand)

JUMP TO: GET POST COOKIES ENV
/home/gollum/.gem/ruby/2.5.0/gems/mustache-0.99.8/lib/mustache/template.rb in render
      # can skip the compilation stage.
/home/gollum/.gem/ruby/2.5.0/gems/mustache-0.99.8/lib/mustache/template.rb in render
      render(context)
/home/gollum/.gem/ruby/2.5.0/gems/mustache-0.99.8/lib/mustache.rb in render
      tpl.render(context)
/home/gollum/.gem/ruby/2.5.0/gems/mustache-0.99.8/lib/mustache/context.rb in partial
      mustache.render(part, self)
/home/gollum/.gem/ruby/2.5.0/gems/mustache-0.99.8/lib/mustache/template.rb in render
      # can skip the compilation stage.
/home/gollum/.gem/ruby/2.5.0/gems/mustache-0.99.8/lib/mustache.rb in render
    return tpl.render(context) if ctx == {}
/home/gollum/.gem/ruby/2.5.0/gems/mustache-0.99.8/lib/mustache/sinatra.rb in mustache
        rendered = instance.render(instance.template, locals)
/home/gollum/.gem/ruby/2.5.0/gems/gollum-5.1.1/lib/gollum/app.rb in block (2 levels) in <class:App>
          mustache :create
/home/gollum/.gem/ruby/2.5.0/gems/rack-protection-2.1.0/lib/rack/protection/xss_header.rb in call
        status, headers, body = @app.call(env)
/home/gollum/.gem/ruby/2.5.0/gems/rack-protection-2.1.0/lib/rack/protection/path_traversal.rb in call
        app.call env
/home/gollum/.gem/ruby/2.5.0/gems/rack-protection-2.1.0/lib/rack/protection/json_csrf.rb in call
        status, headers, body = app.call(env)
/home/gollum/.gem/ruby/2.5.0/gems/rack-protection-2.1.0/lib/rack/protection/base.rb in call
        result or app.call(env)
/home/gollum/.gem/ruby/2.5.0/gems/rack-protection-2.1.0/lib/rack/protection/base.rb in call
        result or app.call(env)
/home/gollum/.gem/ruby/2.5.0/gems/rack-protection-2.1.0/lib/rack/protection/frame_options.rb in call
        status, headers, body        = @app.call(env)
/home/gollum/.gem/ruby/2.5.0/gems/rack-2.2.3/lib/rack/null_logger.rb in call
      @app.call(env)
/home/gollum/.gem/ruby/2.5.0/gems/rack-2.2.3/lib/rack/head.rb in call
      status, headers, body = @app.call(env)
/home/gollum/.gem/ruby/2.5.0/gems/rack-2.2.3/lib/rack/handler/webrick.rb in service
        status, headers, body = @app.call(env)
/usr/lib/ruby/2.5.0/webrick/httpserver.rb in service
      si.service(req, res)
/usr/lib/ruby/2.5.0/webrick/httpserver.rb in run
          server.service(req, res)
/usr/lib/ruby/2.5.0/webrick/server.rb in block in start_thread

Expected behavior
The Create New Page page should be shown.

Environment Info

Gollum 5.1.1
Running on: x86_64-linux-gnu with Ruby version 2.5.5
Using:
rugged 0.99.0
gollum-rugged_adapter 1.0
gollum-lib 5.0.6
Markdown rendering gem: redcarpet
Other renderering gems:
none

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions