Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

### Fixed
- Remove setting `remote.origin.url` for remote git repositories. [#483](https://github.com/sourcebot-dev/sourcebot/pull/483)
- Fix error when navigating to paths with percentage symbols. [#485](https://github.com/sourcebot-dev/sourcebot/pull/485)

### Changed
- Updated NextJS to version 15. [#477](https://github.com/sourcebot-dev/sourcebot/pull/477)
Expand Down
2 changes: 1 addition & 1 deletion packages/web/src/app/[domain]/browse/[...path]/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ export default async function BrowsePage(props: BrowsePageProps) {
domain
} = params;

const rawPath = decodeURIComponent(_rawPath.join('/'));
const rawPath = _rawPath.join('/');
const { repoName, revisionName, path, pathType } = getBrowseParamsFromPathParam(rawPath);

return (
Expand Down
20 changes: 20 additions & 0 deletions packages/web/src/app/[domain]/browse/hooks/utils.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,26 @@ describe('getBrowseParamsFromPathParam', () => {
pathType: 'blob',
});
});

it('should decode paths with percent symbols in path', () => {
const result = getBrowseParamsFromPathParam('github.com/sourcebot-dev/zoekt@HEAD/-/blob/%25hello%25%2Fworld.c');
expect(result).toEqual({
repoName: 'github.com/sourcebot-dev/zoekt',
revisionName: 'HEAD',
path: '%hello%/world.c',
pathType: 'blob',
});
});

it('should decode paths with @ symbol encoded', () => {
const result = getBrowseParamsFromPathParam('github.com/sourcebot-dev/zoekt%40HEAD/-/blob/file.txt');
expect(result).toEqual({
repoName: 'github.com/sourcebot-dev/zoekt',
revisionName: 'HEAD',
path: 'file.txt',
pathType: 'blob',
});
})
});

describe('different revision formats', () => {
Expand Down
2 changes: 1 addition & 1 deletion packages/web/src/app/[domain]/browse/hooks/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ export const getBrowseParamsFromPathParam = (pathParam: string) => {
throw new Error(`Invalid browse pathname: "${pathParam}" - expected to contain "/-/(tree|blob)/" pattern`);
}

const repoAndRevisionPart = pathParam.substring(0, sentinelIndex);
const repoAndRevisionPart = decodeURIComponent(pathParam.substring(0, sentinelIndex));
const lastAtIndex = repoAndRevisionPart.lastIndexOf('@');

const repoName = lastAtIndex === -1 ? repoAndRevisionPart : repoAndRevisionPart.substring(0, lastAtIndex);
Expand Down