Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix #13982: Fix userFQN encoding while creating mentions #14496

Merged
merged 2 commits into from
Dec 26, 2023
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
3 changes: 3 additions & 0 deletions bootstrap/sql/migrations/native/1.2.4/mysql/schemaChanges.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
update field_relationship fr INNER JOIN user_entity ue on fr.fromFQN=ue.name
set fr.fromFQNHASH=MD5(JSON_UNQUOTE(JSON_EXTRACT(ue.json, '$.fullyQualifiedName'))),
fr.fromFQN=JSON_UNQUOTE(JSON_EXTRACT(ue.json, '$.fullyQualifiedName')) where fr.fromType='user';
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
update field_relationship fr
set fromFQNHASH=MD5(ue.json->>'fullyQualifiedName'),
fromFQN=ue.json->>'fullyQualifiedName' from user_entity ue where fr.fromType='user' and fr.fromFQN=ue.name;
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@
import lombok.Getter;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.openmetadata.service.Entity;
import org.openmetadata.service.util.FullyQualifiedName;

@Slf4j
public final class MessageParser {
Expand Down Expand Up @@ -167,18 +169,19 @@ public static EntityLink parse(String link) {
EntityLink entityLink = null;
while (matcher.find()) {
if (entityLink == null) {
String entityType = matcher.group(1);
String entityFQN = matcher.group(2);
if (entityFQN == null) {
throw new IllegalArgumentException(
"Invalid Entity Link. Entity FQN is missing in " + link);
}
if (entityType.equalsIgnoreCase(Entity.USER)
|| entityType.equalsIgnoreCase(Entity.TEAM)) {
entityFQN = FullyQualifiedName.quoteName(entityFQN);
}
entityLink =
new EntityLink(
matcher.group(1),
entityFQN,
matcher.group(4),
matcher.group(6),
matcher.group(8));
entityType, entityFQN, matcher.group(4), matcher.group(6), matcher.group(8));
} else {
throw new IllegalArgumentException("Unexpected multiple entity links in " + link);
}
Expand Down
Loading