Fix the validation issue when the APK file and screenshot names contain spaces

Nipuni Kavindya 1 month ago
parent 991ab26dc5
commit 3c65415121

@ -483,10 +483,6 @@ public class APIUtil {
return application;
}
private static String encodeURI(String value) {
return URLEncoder.encode(value, StandardCharsets.UTF_8);
}
private static final String FILE_NAME_PARAM = "?fileName=";
public static ApplicationRelease releaseDtoToRelease(ApplicationReleaseDTO applicationReleaseDTO)
@ -512,28 +508,28 @@ public class APIUtil {
applicationRelease.setRating(applicationReleaseDTO.getRating());
applicationRelease.setIconPath(
basePath + Constants.ICON_ARTIFACT + FILE_NAME_PARAM +
encodeURI(applicationReleaseDTO.getIconName()));
URLEncoder.encode(applicationReleaseDTO.getIconName(), StandardCharsets.UTF_8));
if (!StringUtils.isEmpty(applicationReleaseDTO.getBannerName())) {
applicationRelease.setBannerPath(
basePath + Constants.BANNER_ARTIFACT + FILE_NAME_PARAM +
encodeURI(applicationReleaseDTO.getBannerName()));
URLEncoder.encode(applicationReleaseDTO.getBannerName(), StandardCharsets.UTF_8));
}
applicationRelease.setInstallerPath(
constructInstallerPath(applicationReleaseDTO.getInstallerName(), applicationReleaseDTO.getAppHashValue()));
if (!StringUtils.isEmpty(applicationReleaseDTO.getScreenshotName1())) {
screenshotPaths.add(
basePath + Constants.SCREENSHOT_ARTIFACT + 1 + FILE_NAME_PARAM +
encodeURI(applicationReleaseDTO.getScreenshotName1()));
URLEncoder.encode(applicationReleaseDTO.getScreenshotName1(), StandardCharsets.UTF_8));
}
if (!StringUtils.isEmpty(applicationReleaseDTO.getScreenshotName2())) {
screenshotPaths.add(
basePath + Constants.SCREENSHOT_ARTIFACT + 2 + FILE_NAME_PARAM +
encodeURI(applicationReleaseDTO.getScreenshotName2()));
URLEncoder.encode(applicationReleaseDTO.getScreenshotName2(), StandardCharsets.UTF_8));
}
if (!StringUtils.isEmpty(applicationReleaseDTO.getScreenshotName3())) {
screenshotPaths.add(
basePath + Constants.SCREENSHOT_ARTIFACT + 3 + FILE_NAME_PARAM +
encodeURI(applicationReleaseDTO.getScreenshotName3()));
URLEncoder.encode(applicationReleaseDTO.getScreenshotName3(), StandardCharsets.UTF_8));
}
applicationRelease.setScreenshots(screenshotPaths);
return applicationRelease;
@ -553,7 +549,8 @@ public class APIUtil {
appHash + Constants.FORWARD_SLASH;
return urlValidator.isValid(installerName)
? installerName
: basePath + Constants.APP_ARTIFACT + FILE_NAME_PARAM + encodeURI(installerName);
: basePath + Constants.APP_ARTIFACT + FILE_NAME_PARAM +
URLEncoder.encode(installerName, StandardCharsets.UTF_8);
}
public static String getArtifactDownloadBaseURL() throws ApplicationManagementException {

Loading…
Cancel
Save