Skip to content

Commit

Permalink
ensure hex string IDs are returned properly in metadata queries
Browse files Browse the repository at this point in the history
  • Loading branch information
AO-StreetArt committed Oct 21, 2018
1 parent f98fd78 commit ba60f27
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
1 change: 1 addition & 0 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ dependencies {
compile('org.springframework.security:spring-security-web:5.1.0.RELEASE')
compile('org.springframework.security:spring-security-config:5.1.0.RELEASE')
compile('org.springframework.security:spring-security-core:5.1.0.RELEASE')
compile('commons-codec:commons-codec:1.5')
runtime('org.springframework.boot:spring-boot-devtools')
errorprone 'com.google.errorprone:error_prone_core:2.2.0'
compileOnly('org.projectlombok:lombok')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@
import java.util.List;
import java.util.stream.Collectors;

import org.apache.commons.codec.binary.Hex;

import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;

Expand Down Expand Up @@ -120,7 +122,7 @@ public ResponseEntity<List<AssetMetadata>> findAssets(
Document metaDoc = mongoFile.getMetadata();
AssetMetadata returnDoc = new AssetMetadata();
logger.info(metaDoc.toString());
returnDoc.setKey(mongoFile.getId().asObjectId().toString());
returnDoc.setKey(Hex.encodeHexString(mongoFile.getId().asObjectId().getValue().toByteArray()));
returnDoc.setContentType(metaDoc.getString("content-type"));
returnDoc.setFileType(metaDoc.getString("file-type"));
returnDoc.setAssetType(metaDoc.getString("asset-type"));
Expand Down

0 comments on commit ba60f27

Please sign in to comment.