Cannot browse file contents that filename contains "+" in Repository tab, 404 error

Added by Mikami Yasuhiro 2 months ago

There is -.txt and +.txt in my subversion repository.

Only +.txt, it looks like that file name is broken, and file name link returned 404.

Anyone have an idea how I can solve this issue?

My environment

Environment:
  Redmine version                5.0.2.stable
  Ruby version                   3.0.4-p208 (2022-04-12) [x86_64-linux]
  Rails version                  6.1.6
  Environment                    production
  Database adapter               PostgreSQL
  Mailer queue                   ActiveJob::QueueAdapters::AsyncAdapter
  Mailer delivery                smtp
Redmine settings:
  Redmine theme                  Verify
SCM:
  Subversion                     1.10.2
  Git                            2.31.1
  Filesystem                     
Redmine plugins:
  no plugin installed

Operating System:                AlmaLinux release 8.6 (Sky Tiger)

Replies (6)

RE: Cannot browse file contents that filename contains "+" in Repository tab, 404 error - Added by Mikami Yasuhiro 2 months ago

Additional, this log in production.scm.stderr.log

It looks like something is converting + to %20 instead of %2B.

svn: warning: W160013: パス '/svn/jo-sys/!svn/rvr/9247/trunk/project/svn_test/%20.txt' が見つかりません
svn: E200009: Could not cat all targets because some targets don't exist
svn: E200009: 要求された操作の対象が不正です

RE: Cannot browse file contents that filename contains "+" in Repository tab, 404 error - Added by Go MAEDA 2 months ago

Does changing lib/redmine/scm/adapters/subversion_adapter.rb as follows fix the problem?

diff --git a/lib/redmine/scm/adapters/subversion_adapter.rb b/lib/redmine/scm/adapters/subversion_adapter.rb
index c3748cadf..756b53be4 100644
--- a/lib/redmine/scm/adapters/subversion_adapter.rb
+++ b/lib/redmine/scm/adapters/subversion_adapter.rb
@@ -115,7 +115,7 @@ module Redmine
                 entries <<
                   Entry.new(
                     {
-                      :name => CGI.unescape(name),
+                      :name => name,
                       :path => ((path.empty? ? "" : "#{path}/") + name),
                       :kind => entry['kind'],
                       :size => ((s = entry['size']) ? s['__content__'].to_i : nil),

RE: Cannot browse file contents that filename contains "+" in Repository tab, 404 error - Added by Mikami Yasuhiro 2 months ago

Thanks for your help.
It looks like fixed my problem.
I will try test other special characters tomorrow just to be sure.

RE: Cannot browse file contents that filename contains "+" in Repository tab, 404 error - Added by Mikami Yasuhiro 2 months ago

I tried special characters "!#$%&'()+,;=@[]^`{}~", and it's work.
I also checked the patch. Thank you again for your help.

RE: Cannot browse file contents that filename contains "+" in Repository tab, 404 error - Added by Mikami Yasuhiro 2 months ago

After patching, I noticed the same issue with the code review plugin.
I'll ask on the plugin's forum.

(1-6/6)