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 behavior for unexisting files for public repositories #243

Merged
merged 5 commits into from
Jan 17, 2022

Conversation

mshaposhnik
Copy link
Contributor

@mshaposhnik mshaposhnik commented Jan 14, 2022

Signed-off-by: Max Shaposhnik mshaposh@redhat.com

What does this PR do?

  • Added check for unexisting files if the're hosted in the public repo. In this case a 404 response returned instead of OAuth login request.

  • Fixed OAuth credentials reading from file

Screenshot/screencast of this PR

What issues does this PR fix or reference?

eclipse-che/che#20994
eclipse-che/che#21014

How to test this PR?

Setup Che, configure OAuth, create factory from public repo with devfile v2.0 but some missing files like
/.che/che-theia-plugins.yaml. 401 was returned on this file previously, and factory failed. After fix 404 is returned, and
factory is launched successfully.

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.

Signed-off-by: Max Shaposhnik <mshaposh@redhat.com>
@mshaposhnik mshaposhnik requested review from benoitf and removed request for nickboldt January 14, 2022 17:37
Signed-off-by: Max Shaposhnik <mshaposh@redhat.com>
Signed-off-by: Max Shaposhnik <mshaposh@redhat.com>
Signed-off-by: Max Shaposhnik <mshaposh@redhat.com>
String clientId = Files.readString(Path.of(clientIdPath));
String clientSecret = Files.readString(Path.of(clientSecretPath));
final String clientId = Files.readString(Path.of(clientIdPath)).trim();
final String clientSecret = Files.readString(Path.of(clientSecretPath)).trim();
Copy link
Contributor

Choose a reason for hiding this comment

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

thanks for this enhancement !


@Override
protected boolean isPublicRepository(GithubUrl remoteFactoryUrl) {
try {
Copy link
Contributor

Choose a reason for hiding this comment

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

Copy link
Contributor Author

@mshaposhnik mshaposhnik Jan 17, 2022

Choose a reason for hiding this comment

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

Now it's just a small helper, which if moved to ApiClient should be expanded to have POJO for response, support authentication etc. so i stick to simpler variant.

@mshaposhnik mshaposhnik merged commit d6cce80 into eclipse-che:main Jan 17, 2022
@mshaposhnik mshaposhnik deleted the fix_oauth_notfound branch January 17, 2022 15:09
skabashnyuk pushed a commit to skabashnyuk/che-server that referenced this pull request Feb 2, 2022
skabashnyuk added a commit to skabashnyuk/che-server that referenced this pull request Feb 2, 2022
…ipse-che#243)

Signed-off-by: Sergii Kabashniuk <skabashniuk@redhat.com>
skabashnyuk added a commit to skabashnyuk/che-server that referenced this pull request Feb 3, 2022
…es (eclipse-che#243)

Signed-off-by: Sergii Kabashniuk <skabashniuk@redhat.com>
skabashnyuk added a commit that referenced this pull request Feb 3, 2022
* Fix behavior for unexisting files for public repositories (#243)

Signed-off-by: Max Shaposhnik <mshaposh@redhat.com>
Signed-off-by: Sergii Kabashniuk <skabashniuk@redhat.com>
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.

3 participants