From a0f5a60ea0c8aca6a5a48ff18880a64ab24e6936 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jacquin=20Th=C3=A9o?= <42nimag@gmail.com> Date: Sun, 29 Jan 2017 00:39:39 +0100 Subject: [PATCH] Solve bug when folder contain non-ascii character MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit When you create a file in a folder with non-ascii character, for exemple "Réseau", after creating the page, it throwed an "URI::InvalidURIError", given the fact that the url returned was "/Réseau/H%C3%A9y", only the part with the name of the file was correctly encoded. So I propose to encode every part of the url to solve this issue So I just --- lib/gollum/app.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/gollum/app.rb b/lib/gollum/app.rb index 0896a79f..2d2300ba 100644 --- a/lib/gollum/app.rb +++ b/lib/gollum/app.rb @@ -348,7 +348,7 @@ module Precious wiki.write_page(name, format, params[:content], commit_message, path) page_dir = settings.wiki_options[:page_file_dir].to_s - redirect to("/#{clean_url(::File.join(page_dir, path, encodeURIComponent(name)))}") + redirect to("/#{clean_url(::File.join(encodeURIComponent(page_dir), encodeURIComponent(path), encodeURIComponent(name)))}") rescue Gollum::DuplicatePageError => e @message = "Duplicate page: #{e.message}" mustache :error