mirror of
https://github.com/scm-manager/scm-manager.git
synced 2026-01-20 06:22:10 +01:00
Fix file search for branches including "/" (#1748)
This commit is contained in:
2
gradle/changelog/file_search.yaml
Normal file
2
gradle/changelog/file_search.yaml
Normal file
@@ -0,0 +1,2 @@
|
||||
- type: Fixed
|
||||
description: Fix file search on branches with "/" ([#1748](https://github.com/scm-manager/scm-manager/pull/1748))
|
||||
@@ -39,7 +39,7 @@ const SearchIcon = styled(Icon)`
|
||||
const FileSearchButton: FC<Props> = ({ baseUrl, revision }) => {
|
||||
const [t] = useTranslation("repos");
|
||||
return (
|
||||
<Link to={`${baseUrl}/search/${revision}`}>
|
||||
<Link to={`${baseUrl}/search/${encodeURIComponent(revision)}`}>
|
||||
<SearchIcon title={t("filesearch.button.title")} name="search" color="inherit" />
|
||||
</Link>
|
||||
);
|
||||
|
||||
@@ -23,13 +23,12 @@
|
||||
*/
|
||||
import React, { FC, useEffect, useState } from "react";
|
||||
import { Branch, Repository } from "@scm-manager/ui-types";
|
||||
import { useHistory, useLocation, useParams } from "react-router-dom";
|
||||
import { Link, useHistory, useLocation, useParams } from "react-router-dom";
|
||||
import { urls, usePaths } from "@scm-manager/ui-api";
|
||||
import { ErrorNotification, FilterInput, Help, Icon, Loading } from "@scm-manager/ui-components";
|
||||
import CodeActionBar from "../components/CodeActionBar";
|
||||
import styled from "styled-components";
|
||||
import FileSearchResults from "../components/FileSearchResults";
|
||||
import { Link } from "react-router-dom";
|
||||
import { useTranslation } from "react-i18next";
|
||||
import { filepathSearch } from "../utils/filepathSearch";
|
||||
|
||||
@@ -67,7 +66,7 @@ const SearchHelp = styled(Help)`
|
||||
|
||||
const useRevision = () => {
|
||||
const { revision } = useParams<Params>();
|
||||
return decodeURIComponent(revision);
|
||||
return revision;
|
||||
};
|
||||
|
||||
const FileSearch: FC<Props> = ({ repository, baseUrl, branches, selectedBranch }) => {
|
||||
@@ -98,12 +97,12 @@ const FileSearch: FC<Props> = ({ repository, baseUrl, branches, selectedBranch }
|
||||
|
||||
const evaluateSwitchViewLink = (type: string) => {
|
||||
if (type === "sources") {
|
||||
return `${baseUrl}/sources/${encodeURIComponent(revision)}/`;
|
||||
return `${baseUrl}/sources/${revision}/`;
|
||||
}
|
||||
return `${baseUrl}/changesets/${encodeURIComponent(revision)}/`;
|
||||
return `${baseUrl}/changesets/${revision}/`;
|
||||
};
|
||||
|
||||
const contentBaseUrl = `${baseUrl}/sources/${encodeURIComponent(revision)}/`;
|
||||
const contentBaseUrl = `${baseUrl}/sources/${revision}/`;
|
||||
|
||||
return (
|
||||
<>
|
||||
|
||||
Reference in New Issue
Block a user