Skip to content

Commit

Permalink
fix: Allow to get files from git repository if file name starts with dot
Browse files Browse the repository at this point in the history
Signed-off-by: Vitaliy Gulyy <[email protected]>
  • Loading branch information
vitaliy-guliy committed Sep 9, 2022
1 parent 893d6ae commit 723d332
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,6 @@ public void shouldResolveRelativePaths(String relative, String expected, String
public static Object[][] relativePathsProvider() {
return new Object[][] {
{"./file.txt", "https://foo.bar/rest/api/1.0/projects/proj/repos/repo/raw/file.txt", null},
{"../file.txt", "https://foo.bar/rest/api/1.0/projects/proj/repos/repo/raw/file.txt", null},
{"/file.txt", "https://foo.bar/rest/api/1.0/projects/proj/repos/repo/raw/file.txt", null},
{"file.txt", "https://foo.bar/rest/api/1.0/projects/proj/repos/repo/raw/file.txt", null},
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -146,9 +146,9 @@ protected String formatUrl(String fileURL) throws DevfileException {
requestURL = fileURL;
} else {
// since files retrieved via REST, we cannot use path like '.' or one that starts with './'
// or '../', so cut them off
// so cut them off
requestURL =
remoteFactoryUrl.rawFileLocation(fileURL.replaceAll("^(?:\\.*\\/)|(?:\\.$)", ""));
remoteFactoryUrl.rawFileLocation(fileURL.replaceAll("^(?:\\.?\\/)|(?:\\.$)", ""));
}
} catch (URISyntaxException e) {
throw new DevfileException(e.getMessage(), e);
Expand Down

0 comments on commit 723d332

Please sign in to comment.