Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 5 additions & 4 deletions src/main/java/com/box/sdk/BoxFileRequest.java
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,8 @@ public BoxFileRequest.Info copyInfo(String folderId) {
request.setBody(body.toString());
try (BoxJSONResponse response = request.send()) {
JsonObject jsonObject = Json.parse(response.getJSON()).asObject();
return new Info(jsonObject, this.getAPI().getBaseAppUrl());
String id = jsonObject.get("id").asString();
return new BoxFileRequest(this.getAPI(), id).new Info(jsonObject, this.getAPI().getBaseAppUrl());
}
}

Expand Down Expand Up @@ -91,8 +92,8 @@ public BoxFileRequest.Info copyInfo(BoxFileRequest.Info info, String folderId) {
request.setBody(body.toString());
try (BoxJSONResponse response = request.send()) {
JsonObject jsonObject = Json.parse(response.getJSON()).asObject();
info.update(jsonObject);
return new Info(jsonObject, this.getAPI().getBaseAppUrl());
String id = jsonObject.get("id").asString();
return new BoxFileRequest(this.getAPI(), id).new Info(jsonObject, this.getAPI().getBaseAppUrl());
}
}

Expand Down Expand Up @@ -199,7 +200,7 @@ public Info(String json) {
/**
* Constructs an Info object using an already parsed JSON object.
*
* @param jsonObject the parsed JSON object.
* @param jsonObject the parsed JSON object.
* @param fileRequestBaseUrl Request base URL
*/
Info(JsonObject jsonObject, String fileRequestBaseUrl) {
Expand Down
2 changes: 1 addition & 1 deletion src/test/Fixtures/BoxFileRequest/CopyFileRequest200.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"id": "42037322",
"id": "82037344",
"type": "file-request",
"created_at": "2020-09-28T10:53:43-08:00",
"created_by": {
Expand Down
2 changes: 2 additions & 0 deletions src/test/java/com/box/sdk/BoxFileRequestTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import static com.github.tomakehurst.wiremock.core.WireMockConfiguration.wireMockConfig;
import static java.lang.String.format;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotEquals;

import com.eclipsesource.json.JsonObject;
import com.github.tomakehurst.wiremock.client.WireMock;
Expand Down Expand Up @@ -99,6 +100,7 @@ public void copyFileRequestSucceeds() {
assertEquals(fileRequestInfo.getDescription(), description);
assertEquals(fileRequestInfo.getIsDescriptionRequired(), true);
assertEquals(fileRequestInfo.getStatus(), status);
assertNotEquals(fileRequestInfo.getID(), fileRequestID);
}

@Test
Expand Down
Loading