File tree Expand file tree Collapse file tree
java/kattsyn/dev/rentplace/services/impl Expand file tree Collapse file tree Original file line number Diff line number Diff line change 77import kattsyn .dev .rentplace .services .ImageService ;
88import kattsyn .dev .rentplace .services .StorageService ;
99import lombok .RequiredArgsConstructor ;
10+ import lombok .extern .slf4j .Slf4j ;
1011import org .springframework .beans .factory .annotation .Value ;
1112import org .springframework .core .io .Resource ;
1213import org .springframework .stereotype .Service ;
1314import org .springframework .web .multipart .MultipartFile ;
1415
1516@ Service
17+ @ Slf4j
1618@ RequiredArgsConstructor
1719public 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 ("Файл слишком большой" );
Original file line number Diff line number Diff line change @@ -40,7 +40,7 @@ commission:
4040 in_percent : 4
4141jwt :
4242 expiration_time_in_minutes :
43- access : 5
43+ access : 15
4444 expiration_time_in_days :
4545 refresh : 30
4646 secret :
You can’t perform that action at this time.
0 commit comments