Skip to content
Snippets Groups Projects
Commit 89178677 authored by Greg DiCristofaro's avatar Greg DiCristofaro
Browse files

some fixes

parent 9a702f5c
No related branches found
No related tags found
No related merge requests found
......@@ -96,7 +96,7 @@ public void uploadFile(String url, String fileName, InputStream fileIs) throws C
}
public void uploadMeta(AuthenticatedRequestData authenticatedRequestData, MetadataUploadRequest metaRequest) throws CTCloudException {
httpClient.doPost(AUTH_TOKEN_REQUEST_PATH, getAuthParams(authenticatedRequestData), metaRequest, null);
httpClient.doPost(CTCLOUD_UPLOAD_FILE_METADATA_PATH, getAuthParams(authenticatedRequestData), metaRequest, null);
}
private static Map<String, String> getAuthParams(AuthenticatedRequestData authenticatedRequestData) {
......
......@@ -38,10 +38,10 @@ public class MetadataUploadRequest {
private String filePath;
@JsonProperty("fileSize")
private long fileSizeBytes;
private Long fileSizeBytes;
@JsonProperty("createdDate")
private long createdDate;
private Long createdDate;
public String getFileUploadUrl() {
return fileUploadUrl;
......@@ -88,20 +88,20 @@ public MetadataUploadRequest setFilePath(String filePath) {
return this;
}
public long getFileSizeBytes() {
public Long getFileSizeBytes() {
return fileSizeBytes;
}
public MetadataUploadRequest setFileSizeBytes(long fileSizeBytes) {
public MetadataUploadRequest setFileSizeBytes(Long fileSizeBytes) {
this.fileSizeBytes = fileSizeBytes;
return this;
}
public long getCreatedDate() {
public Long getCreatedDate() {
return createdDate;
}
public MetadataUploadRequest setCreatedDate(long createdDate) {
public MetadataUploadRequest setCreatedDate(Long createdDate) {
this.createdDate = createdDate;
return this;
}
......
......@@ -462,7 +462,7 @@ private void handleNonFoundResults(IngestJobState ingestJobState, Map<String, Li
}
if (performFileUpload) {
uploadFile(ingestJobState, correspondingObjIds.get(0));
uploadFile(ingestJobState, sanitizedMd5, correspondingObjIds.get(0));
}
ingestJobState.getUnidentifiedHashes().put(sanitizedMd5, correspondingObjIds);
......@@ -539,7 +539,7 @@ private static boolean isUploadable(AbstractFile af) {
* @throws CTCloudException
* @throws TskCoreException
*/
private boolean uploadFile(IngestJobState ingestJobState, long objId) throws CTCloudException, TskCoreException {
private boolean uploadFile(IngestJobState ingestJobState, String md5, long objId) throws CTCloudException, TskCoreException {
if (!ingestJobState.isUploadUnknownFiles() || ingestJobState.getIngestJobContext().fileIngestIsCancelled()) {
return false;
}
......@@ -567,11 +567,12 @@ private boolean uploadFile(IngestJobState ingestJobState, long objId) throws CTC
// upload metadata
MetadataUploadRequest metaRequest = new MetadataUploadRequest()
.setCreatedDate(af.getCrtime())
.setCreatedDate(af.getCrtime() == 0 ? null : af.getCrtime())
.setFilePath(af.getUniquePath())
.setFileSizeBytes(af.getSize())
.setFileUploadUrl(authTokenResponse.getFileUploadUrl())
.setMd5(af.getMd5Hash())
.setMd5(md5)
// these may be missing, but that's fine
.setSha1(af.getSha1Hash())
.setSha256(af.getSha256Hash());
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment