Skip to content

Commit

Permalink
fix(urns): prevent corrupting whitespace trailing or leading urns to …
Browse files Browse the repository at this point in the history
…be created (#3348)
  • Loading branch information
gabe-lyons authored Oct 8, 2021
1 parent 03bbfd0 commit a5926a5
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
2 changes: 1 addition & 1 deletion datahub-web-react/src/app/shared/tags/CreateTagModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ export default function CreateTagModal({
})
.catch((e) => {
message.destroy();
message.error({ content: `Failed to remove term: \n ${e.message || ''}`, duration: 3 });
message.error({ content: `Failed to create & add tag: \n ${e.message || ''}`, duration: 3 });
onClose();
});
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -202,6 +202,11 @@ public RecordTemplate ingestAspect(@Nonnull final Urn urn, @Nonnull final String
@Nonnull final SystemMetadata systemMetadata) {

log.debug("Invoked ingestAspect with urn: {}, aspectName: {}, newValue: {}", urn, aspectName, newValue);

if (!urn.toString().trim().equals(urn.toString())) {
throw new IllegalArgumentException("Error: cannot provide an URN with leading or trailing whitespace");
}

Timer.Context ingestToLocalDBTimer = MetricUtils.timer(this.getClass(), "ingestAspectToLocalDB").time();
UpdateAspectResult result = ingestAspectToLocalDB(urn, aspectName, ignored -> newValue, auditStamp, systemMetadata,
DEFAULT_MAX_TRANSACTION_RETRY);
Expand Down

0 comments on commit a5926a5

Please sign in to comment.