Skip to content

RepositoryFileApi.getRawFile throws GitLabApiException redirected #282

@icnbrave

Description

@icnbrave

I try to run the test case https://github.com/gmessner/gitlab4j-api/blob/master/src/test/java/org/gitlab4j/api/TestRepositoryFileApi.java#L121, but the exception below will be thrown. Could you provide any advice on this?

org.gitlab4j.api.GitLabApiException: <html><body>You are being <a href="https://login.alibaba-inc.com/ssoLogin.htm?APP_NAME=aligitlab&amp;BACK_URL=http%3A%2F%2Fgitlab.alibaba-inc.com%2Fapi%2Fv3%2Fprojects%2F518335%2Frepository%2Ffiles%2FREADME%252Emd%2Fraw%3Fref%3Dmaster">redirected</a>.</body></html>

	at org.gitlab4j.api.AbstractApi.validate(AbstractApi.java:532)
	at org.gitlab4j.api.AbstractApi.getWithAccepts(AbstractApi.java:210)
	at org.gitlab4j.api.RepositoryFileApi.getRawFile(RepositoryFileApi.java:328)
	at com.aliyun.globalization.Gitlab4JAPITest.testRawFileViaFile(Gitlab4JAPITest.java:83)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50)
	at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
	at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47)
	at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
	at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:26)
	at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325)
	at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:78)
	at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:57)
	at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
	at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)
	at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)
	at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)
	at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)
	at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:26)
	at org.junit.internal.runners.statements.RunAfters.evaluate(RunAfters.java:27)
	at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
	at org.junit.runner.JUnitCore.run(JUnitCore.java:137)
	at com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:68)
	at com.intellij.rt.execution.junit.IdeaTestRunner$Repeater.startRunnerWithArgs(IdeaTestRunner.java:47)
	at com.intellij.rt.execution.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:242)
	at com.intellij.rt.execution.junit.JUnitStarter.main(JUnitStarter.java:70)

In addition, the version of our gitlab server is v3, and createFile, deleteFile, updateFile and deprecated getFile(String filePath, Integer projectId, String ref) can work correctly. But below file information fetching functions will be thrown 302 error.

gitLabApi.getRepositoryFileApi().getRawFile(project.getId(), "master", "README.md", new File("."));
gitLabApi.getRepositoryFileApi().getFileInfo(project.getId(), "README.md", "master");
gitLabApi.getRepositoryFileApi().getOptionalFileInfo(project.getId(), "DONT-EXIST", "master");

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions