diff --git a/modules/core/src/com/haulmont/addon/cubaaws/s3/AmazonS3FileStorage.java b/modules/core/src/com/haulmont/addon/cubaaws/s3/AmazonS3FileStorage.java index 7e0b0e3..9bece25 100644 --- a/modules/core/src/com/haulmont/addon/cubaaws/s3/AmazonS3FileStorage.java +++ b/modules/core/src/com/haulmont/addon/cubaaws/s3/AmazonS3FileStorage.java @@ -220,10 +220,21 @@ protected String getStorageDir(Date createDate) { } protected String getFileName(FileDescriptor fileDescriptor) { - if (StringUtils.isNotBlank(fileDescriptor.getExtension())) { - return fileDescriptor.getId().toString() + "." + fileDescriptor.getExtension(); - } else { - return fileDescriptor.getId().toString(); + if (StringUtils.isNotBlank(fileDescriptor.getName())) { + if (StringUtils.isNotBlank(fileDescriptor.getExtension())) { + return fileDescriptor.getName() + "." + fileDescriptor.getExtension(); + } + else { + return fileDescriptor.getName(); + } + } + else { + if (StringUtils.isNotBlank(fileDescriptor.getExtension())) { + return fileDescriptor.getId().toString() + "." + fileDescriptor.getExtension(); + } + else { + return fileDescriptor.getId().toString(); + } } } @@ -242,4 +253,4 @@ protected String getSecretAccessKey() { protected String getAccessKey() { return amazonS3Config.getAccessKey(); } -} \ No newline at end of file +}