From 81836ffbc69a1c013175eb80718f27ef687d9145 Mon Sep 17 00:00:00 2001 From: Igor Vinokur Date: Mon, 25 Jul 2022 16:46:34 +0300 Subject: [PATCH] fix: Fix che-editor.yaml recognition (#334) Pass the file path through the rawFileLocation function to avoid dot cut Encode the .che/che-editor subpath to meet the Gitlab raw file request requirements. --- .../che/api/factory/server/gitlab/GitlabScmFileResolver.java | 4 ++-- .../org/eclipse/che/api/factory/server/gitlab/GitlabUrl.java | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/wsmaster/che-core-api-factory-gitlab/src/main/java/org/eclipse/che/api/factory/server/gitlab/GitlabScmFileResolver.java b/wsmaster/che-core-api-factory-gitlab/src/main/java/org/eclipse/che/api/factory/server/gitlab/GitlabScmFileResolver.java index 73b5bca098..e4439c7a6e 100644 --- a/wsmaster/che-core-api-factory-gitlab/src/main/java/org/eclipse/che/api/factory/server/gitlab/GitlabScmFileResolver.java +++ b/wsmaster/che-core-api-factory-gitlab/src/main/java/org/eclipse/che/api/factory/server/gitlab/GitlabScmFileResolver.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012-2021 Red Hat, Inc. + * Copyright (c) 2012-2022 Red Hat, Inc. * This program and the accompanying materials are made * available under the terms of the Eclipse Public License 2.0 * which is available at https://www.eclipse.org/legal/epl-2.0/ @@ -55,7 +55,7 @@ public class GitlabScmFileResolver implements ScmFileResolver { try { return new GitlabAuthorizingFileContentProvider( gitlabUrl, urlFetcher, gitCredentialManager, personalAccessTokenManager) - .fetchContent(filePath); + .fetchContent(gitlabUrl.rawFileLocation(filePath)); } catch (IOException e) { throw new NotFoundException(e.getMessage()); } catch (DevfileException devfileException) { diff --git a/wsmaster/che-core-api-factory-gitlab/src/main/java/org/eclipse/che/api/factory/server/gitlab/GitlabUrl.java b/wsmaster/che-core-api-factory-gitlab/src/main/java/org/eclipse/che/api/factory/server/gitlab/GitlabUrl.java index be6c9ca58b..e8321efcd7 100644 --- a/wsmaster/che-core-api-factory-gitlab/src/main/java/org/eclipse/che/api/factory/server/gitlab/GitlabUrl.java +++ b/wsmaster/che-core-api-factory-gitlab/src/main/java/org/eclipse/che/api/factory/server/gitlab/GitlabUrl.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2012-2021 Red Hat, Inc. + * Copyright (c) 2012-2022 Red Hat, Inc. * This program and the accompanying materials are made * available under the terms of the Eclipse Public License 2.0 * which is available at https://www.eclipse.org/legal/epl-2.0/ @@ -207,7 +207,7 @@ public class GitlabUrl implements RemoteFactoryUrl { .add(geProjectIdentifier()) .add("repository") .add("files") - .add(fileName) + .add(encode(fileName, Charsets.UTF_8)) .add("raw") .toString(); if (branch != null) {