Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
佳 邓
Gitlab4j Api
Commits
b801ab04
Commit
b801ab04
authored
Mar 11, 2020
by
Greg Messner
Browse files
Now URL encodes refs and branch names (#530)
parent
97124b33
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/main/java/org/gitlab4j/api/RepositoryFileApi.java
View file @
b801ab04
...
@@ -61,7 +61,7 @@ public class RepositoryFileApi extends AbstractApi {
...
@@ -61,7 +61,7 @@ public class RepositoryFileApi extends AbstractApi {
public
RepositoryFile
getFileInfo
(
Object
projectIdOrPath
,
String
filePath
,
String
ref
)
throws
GitLabApiException
{
public
RepositoryFile
getFileInfo
(
Object
projectIdOrPath
,
String
filePath
,
String
ref
)
throws
GitLabApiException
{
Form
form
=
new
Form
();
Form
form
=
new
Form
();
addFormParam
(
form
,
"ref"
,
ref
,
true
);
addFormParam
(
form
,
"ref"
,
(
ref
!=
null
?
urlEncode
(
ref
)
:
null
)
,
true
);
Response
response
=
head
(
Response
.
Status
.
OK
,
form
.
asMap
(),
Response
response
=
head
(
Response
.
Status
.
OK
,
form
.
asMap
(),
"projects"
,
getProjectIdOrPath
(
projectIdOrPath
),
"repository"
,
"files"
,
urlEncode
(
filePath
));
"projects"
,
getProjectIdOrPath
(
projectIdOrPath
),
"repository"
,
"files"
,
urlEncode
(
filePath
));
...
@@ -162,7 +162,7 @@ public class RepositoryFileApi extends AbstractApi {
...
@@ -162,7 +162,7 @@ public class RepositoryFileApi extends AbstractApi {
}
}
Form
form
=
new
Form
();
Form
form
=
new
Form
();
addFormParam
(
form
,
"ref"
,
ref
,
true
);
addFormParam
(
form
,
"ref"
,
(
ref
!=
null
?
urlEncode
(
ref
)
:
null
)
,
true
);
Response
response
=
get
(
Response
.
Status
.
OK
,
form
.
asMap
(),
"projects"
,
getProjectIdOrPath
(
projectIdOrPath
),
"repository"
,
"files"
,
urlEncode
(
filePath
));
Response
response
=
get
(
Response
.
Status
.
OK
,
form
.
asMap
(),
"projects"
,
getProjectIdOrPath
(
projectIdOrPath
),
"repository"
,
"files"
,
urlEncode
(
filePath
));
return
(
response
.
readEntity
(
RepositoryFile
.
class
));
return
(
response
.
readEntity
(
RepositoryFile
.
class
));
}
}
...
@@ -325,7 +325,8 @@ public class RepositoryFileApi extends AbstractApi {
...
@@ -325,7 +325,8 @@ public class RepositoryFileApi extends AbstractApi {
}
}
Form
form
=
new
Form
();
Form
form
=
new
Form
();
addFormParam
(
form
,
isApiVersion
(
ApiVersion
.
V3
)
?
"branch_name"
:
"branch"
,
branchName
,
true
);
addFormParam
(
form
,
isApiVersion
(
ApiVersion
.
V3
)
?
"branch_name"
:
"branch"
,
(
branchName
!=
null
?
urlEncode
(
branchName
)
:
null
),
true
);
addFormParam
(
form
,
"commit_message"
,
commitMessage
,
true
);
addFormParam
(
form
,
"commit_message"
,
commitMessage
,
true
);
Response
.
Status
expectedStatus
=
(
isApiVersion
(
ApiVersion
.
V3
)
?
Response
.
Status
.
OK
:
Response
.
Status
.
NO_CONTENT
);
Response
.
Status
expectedStatus
=
(
isApiVersion
(
ApiVersion
.
V3
)
?
Response
.
Status
.
OK
:
Response
.
Status
.
NO_CONTENT
);
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment