Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: remotes url parameter in factory url #938

Merged
merged 2 commits into from
Oct 4, 2023
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
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,22 @@ describe('FactoryLocationAdapter Service', () => {
});
});

describe('test FactoryLocationAdapter.isHttpLocation', () => {
it('should return true for https git url', () => {
const location = 'https://git-test.com/dummy.git';
expect(FactoryLocationAdapter.isHttpLocation(location)).toBeTruthy();
});
it('should return true when git remote specified', () => {
const location = 'https://git-test.com/dummy.git?remotes={https://git-test.com/remote.git}';
expect(FactoryLocationAdapter.isHttpLocation(location)).toBeTruthy();
});
it('should return true when git remotes and remote names are specified', () => {
const location =
'https://git-test.com/dummy.git?remotes={{origin,https://git-test.com/origin.git},{upstream,https://git-test.com/upstream.git}}';
expect(FactoryLocationAdapter.isHttpLocation(location)).toBeTruthy();
});
});

it('should return factory reference without oauth params', () => {
const fullPathUrl = 'https://github.com/eclipse-che/che-dashboard.git';
const oauthParams = 'session_state=63273265623765783252378';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ export class FactoryLocationAdapter implements FactoryLocation {
}

public static isHttpLocation(href: string): boolean {
return /^(https?:\/\/.)[-a-zA-Z0-9@:%._+~#=]{2,}\b([-a-zA-Z0-9@:%_+.~#?&/=]*)$/.test(href);
return /^(https?:\/\/.)[-a-zA-Z0-9@:%._+~#=]{2,}\b([-a-zA-Z0-9@:%_+.~#?&/={},]*)$/.test(href);
olexii4 marked this conversation as resolved.
Show resolved Hide resolved
}

public static isSshLocation(href: string): boolean {
Expand Down
Loading