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: Allow to get files from git repository if file name starts with dot #351

Merged
merged 1 commit into from
Sep 9, 2022

Conversation

vitaliy-guliy
Copy link
Contributor

@vitaliy-guliy vitaliy-guliy commented Sep 7, 2022

Signed-off-by: Vitaliy Gulyy [email protected]

What does this PR do?

Fixes retrieving files from git repository when filename or directory name starts with dots.

Screenshot/screencast of this PR

Screenshot from 2022-09-07 18-01-29

Screenshot from 2022-09-07 18-10-39

What issues does this PR fix or reference?

Fixes eclipse-che/che#21635, and potentially eclipse-che/che#21639

How to test this PR?

  1. Deploy Che with
chectl server:deploy -p=minikube -i=quay.io/vgulyy/che-server:test-fetching-git-files
  1. Create a workspace with a factory
    https://github.com/che-samples/java-spring-petclinic/tree/devfilev2?che-editor=eclipse/che-theia/next

  2. Open Plugins view, check for installed plugins. Open terminal in editor container, check for .vsix files existence in /plugins/sidecars/tools directory.

PR Checklist

As the author of this Pull Request I made sure that:

Reviewers

Reviewers, please comment how you tested the PR when approving it.

Copy link
Contributor

@svor svor left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM
screenshot-eclipse-che apps ci-ln-zbsx2bb-72292 origin-ci-int-gce dev rhcloud com-2022 09 08-09_49_21
screenshot-eclipse-che apps ci-ln-zbsx2bb-72292 origin-ci-int-gce dev rhcloud com-2022 09 08-09_42_50

@nickboldt
Copy link
Contributor

This needs to be backported to 7.52.x branch for DS 3.2.

// since files retrieved via REST, we cannot use path symbols like . ./ so cut them off
requestURL = remoteFactoryUrl.rawFileLocation(fileURL.replaceAll("^[/.]+", ""));
// since files retrieved via REST, we cannot use path like '.' or one that starts with './'
// or '../', so cut them off
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If we cut ../ of then we will have a wrong location, right?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We addressing the resource, beginning from the repository root, and this cutting does not change anything.
But yes, it looks a bit confusing, just take a look at the test https://github.com/eclipse-che/che-server/blob/main/wsmaster/che-core-api-factory-bitbucket-server/src/test/java/org/eclipse/che/api/factory/server/bitbucket/BitbucketServerAuthorizingFileContentProviderTest.java#L115

Let me try to remove cutting of ../, update the PR and republish che-server image, that is used to test.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Files in .vscode and .che folders of a git repository are ignored at workspace creation
5 participants