Skip to content

Commit beeaf49

Browse files
committed
feat: increased accessToken time and allowed to add svg images
1 parent 874ed4a commit beeaf49

2 files changed

Lines changed: 6 additions & 3 deletions

File tree

rentplace/src/main/java/kattsyn/dev/rentplace/services/impl/ImageServiceImpl.java

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,14 @@
77
import kattsyn.dev.rentplace.services.ImageService;
88
import kattsyn.dev.rentplace.services.StorageService;
99
import lombok.RequiredArgsConstructor;
10+
import lombok.extern.slf4j.Slf4j;
1011
import org.springframework.beans.factory.annotation.Value;
1112
import org.springframework.core.io.Resource;
1213
import org.springframework.stereotype.Service;
1314
import org.springframework.web.multipart.MultipartFile;
1415

1516
@Service
17+
@Slf4j
1618
@RequiredArgsConstructor
1719
public class ImageServiceImpl implements ImageService {
1820

@@ -29,8 +31,9 @@ private void validateImage(MultipartFile file) {
2931
if (file.isEmpty()) {
3032
throw new RuntimeException("Файл пустой");
3133
}
32-
if (!"image/jpeg".equals(contentType) && !"image/png".equals(contentType)) {
33-
throw new RuntimeException("Поддерживаются только JPEG и PNG изображения");
34+
log.info("Content-Type: " + contentType);
35+
if (!"image/jpeg".equals(contentType) && !"image/png".equals(contentType) && !"image/svg+xml".equals(contentType)) {
36+
throw new RuntimeException("Поддерживаются только JPEG, PNG и SVG изображения");
3437
}
3538
if (file.getSize() > 5 * 1024 * 1024) {
3639
throw new RuntimeException("Файл слишком большой");

rentplace/src/main/resources/application.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ commission:
4040
in_percent: 4
4141
jwt:
4242
expiration_time_in_minutes:
43-
access: 5
43+
access: 15
4444
expiration_time_in_days:
4545
refresh: 30
4646
secret:

0 commit comments

Comments
 (0)