Skip to content

Commit

Permalink
fix: resolve PR comments
Browse files Browse the repository at this point in the history
  • Loading branch information
astsiapanay committed Jan 28, 2025
1 parent 7ccc0b7 commit 5ce566b
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package com.epam.aidial.core.server.service;

import com.epam.aidial.core.server.data.ResourceTypes;
import com.epam.aidial.core.server.security.EncryptionService;
import com.epam.aidial.core.server.util.ProxyUtil;
import com.epam.aidial.core.server.util.ResourceDescriptorFactory;
Expand Down Expand Up @@ -112,6 +113,9 @@ static String buildTargetFolderForCustomAppFiles(String targetUrl, EncryptionSer
if (descriptor.isFolder()) {
throw new IllegalArgumentException("target url must be a file");
}
if (descriptor.getType() != ResourceTypes.APPLICATION) {
throw new IllegalArgumentException("target url must be an application type");
}
String appName = descriptor.getName();
List<String> folders = descriptor.getParentFolders();
if (folders.isEmpty()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ public void testBuildTargetFolderForCustomAppFiles() {
assertEquals("folder/.appA/", PublicationUtil.buildTargetFolderForCustomAppFiles("applications/asdfoiefjio/folder/appA", encryptionService));
assertEquals(".appA/", PublicationUtil.buildTargetFolderForCustomAppFiles("applications/asdfoiefjio/appA", encryptionService));
assertThrows(IllegalArgumentException.class, () -> PublicationUtil.buildTargetFolderForCustomAppFiles("applications/asdfoiefjio/appA/", encryptionService));
assertThrows(IllegalArgumentException.class, () -> PublicationUtil.buildTargetFolderForCustomAppFiles("prompts/asdfoiefjio/appA", encryptionService));
}

@Test
Expand Down

0 comments on commit 5ce566b

Please sign in to comment.