diff --git a/src/main/java/com/epam/aidial/core/service/PublicationService.java b/src/main/java/com/epam/aidial/core/service/PublicationService.java index 48039edc8..c43f887e6 100644 --- a/src/main/java/com/epam/aidial/core/service/PublicationService.java +++ b/src/main/java/com/epam/aidial/core/service/PublicationService.java @@ -589,7 +589,8 @@ private void collectLinksForReplacement(List publicConversa if (type == ResourceType.CONVERSATION) { publicConversations.add(to); } else if (type == ResourceType.FILE) { - attachmentsMap.put(from.getUrl(), to.getUrl()); + String decodedUrl = UrlUtil.decodePath(from.getUrl()); + attachmentsMap.put(decodedUrl, to.getUrl()); } else if (type == ResourceType.APPLICATION) { publicApplications.add(to); } diff --git a/src/main/java/com/epam/aidial/core/service/PublicationUtil.java b/src/main/java/com/epam/aidial/core/service/PublicationUtil.java index 73103cefc..a83d1c1b5 100644 --- a/src/main/java/com/epam/aidial/core/service/PublicationUtil.java +++ b/src/main/java/com/epam/aidial/core/service/PublicationUtil.java @@ -4,6 +4,7 @@ import com.epam.aidial.core.storage.BlobStorageUtil; import com.epam.aidial.core.storage.ResourceDescription; import com.epam.aidial.core.util.ProxyUtil; +import com.epam.aidial.core.util.UrlUtil; import io.vertx.core.json.JsonArray; import io.vertx.core.json.JsonObject; import lombok.experimental.UtilityClass; @@ -85,7 +86,8 @@ private void replaceAttachments(JsonArray messages, Map attachme isMetadata = true; url = url.substring(ProxyUtil.METADATA_PREFIX.length()); } - String toReplace = attachmentsMapping.get(url); + String decodedUrl = UrlUtil.decodePath(url); + String toReplace = attachmentsMapping.get(decodedUrl); if (toReplace != null) { attachment.put("url", isMetadata ? ProxyUtil.METADATA_PREFIX + toReplace : toReplace); }