Skip to content

links to files in History lead to error 400 #4931

@m4mmon

Description

@m4mmon

Describe the bug
When browsing a repository, using History and clicking "Show modified files >>>", the links there lead to an error 400.

Running opengrok on Windows.
OpenGrok v1.14.11

openjdk version "21.0.9" 2025-10-21 LTS
IBM Semeru Runtime Open Edition 21.0.9.0 (build 21.0.9+10-LTS)

Universal Ctags 6.2.0(p6.2.20260208.0), Copyright (C) 2015-2025 Universal Ctags Team

git version 2.51.1.windows.1

To Reproduce
Create a git repository with a couple commits.
Index it.
Browse it in opengrok.
Click History link at the top.
Click "Show modified files >>>"
Click on a link => error

HTTP Status 400 – Bad Request Type Status Report Message Invalid URI Description The server cannot or will not process the request due to something that is perceived to be a client error (e.g., malformed request syntax, invalid request message framing, or deceptive request routing). 

Expected behavior
The linked file should open properly, like when just browsing.

Additional context
When inspecting the link, it looks like:
<a class="h" href="/source2/xref%5Ctestproj%5Cfile1.txt?r=2b126ca2957119f068ce8f7efb369f3e4e0e4ce2">\testproj\file1.txt</a>

I have not found other places where the backslash is encoded in the href, e.g. browsing, search results, etc.
I had an old 1.7.31 version running with no issues regarding paths with backslashes, but since we have migrated everything and cannot resurrect it, but if I remember well, the backslashes in the link were not url-encoded.

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