From 4b93ce308becdc693605c75019de34daab9f9092 Mon Sep 17 00:00:00 2001 From: Tete17 Date: Sat, 27 May 2023 19:20:42 +0200 Subject: [PATCH] fix(ui): Stop using the deprecated url format for gitlab instances (#13687) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * fix: Stop using the deprecated url format for gitlab instances The legacy URLs format has been deprecated since february 2023 and now gitlab is make these urls invalid. Ref: https://docs.gitlab.com/ee/update/deprecations.html#legacy-urls-replaced-or-removed Signed-off-by: Miguel Sacristán Izcue * docs: Add Urbantz to the list of organizations using argo-cd Signed-off-by: Miguel Sacristán Izcue --------- Signed-off-by: Miguel Sacristán Izcue (cherry picked from commit 566236747474593d4e0d22a0398ffbcca2ff29aa) Signed-off-by: Miguel Sacristán Izcue --- USERS.md | 1 + ui/src/app/shared/components/urls.test.ts | 2 +- ui/src/app/shared/components/urls.ts | 6 ++++++ 3 files changed, 8 insertions(+), 1 deletion(-) diff --git a/USERS.md b/USERS.md index 4252bbd2c1430..9ff3b559d895e 100644 --- a/USERS.md +++ b/USERS.md @@ -239,6 +239,7 @@ Currently, the following organizations are **officially** using Argo CD: 1. [ungleich.ch](https://ungleich.ch/) 1. [Unifonic Inc](https://www.unifonic.com/) 1. [Universidad Mesoamericana](https://www.umes.edu.gt/) +1. [Urbantz](https://urbantz.com/) 1. [Viaduct](https://www.viaduct.ai/) 1. [Vinted](https://vinted.com/) 1. [Virtuo](https://www.govirtuo.com/) diff --git a/ui/src/app/shared/components/urls.test.ts b/ui/src/app/shared/components/urls.test.ts index 9459dfecd7af1..17101fe175418 100644 --- a/ui/src/app/shared/components/urls.test.ts +++ b/ui/src/app/shared/components/urls.test.ts @@ -35,7 +35,7 @@ test('gitlab.com', () => { 'git@gitlab.com:alex_collins/private-repo.git', 'b1fe9426ead684d7af16958920968342ee295c1f', 'https://gitlab.com/alex_collins/private-repo', - 'https://gitlab.com/alex_collins/private-repo/commit/b1fe9426ead684d7af16958920968342ee295c1f'); + 'https://gitlab.com/alex_collins/private-repo/-/commit/b1fe9426ead684d7af16958920968342ee295c1f'); }); test('bitbucket.org', () => { diff --git a/ui/src/app/shared/components/urls.ts b/ui/src/app/shared/components/urls.ts index 9303d43d7da11..ab68e6424ba86 100644 --- a/ui/src/app/shared/components/urls.ts +++ b/ui/src/app/shared/components/urls.ts @@ -39,6 +39,12 @@ export function revisionUrl(url: string, revision: string, forPath: boolean): st urlSubPath = isSHA(revision) && !forPath ? 'commits' : 'src'; } + // Gitlab changed the way urls to commit look like + // Ref: https://docs.gitlab.com/ee/update/deprecations.html#legacy-urls-replaced-or-removed + if (parsed.source === 'gitlab.com') { + urlSubPath = '-/' + urlSubPath; + } + if (!supportedSource(parsed)) { return null; }