patch prod

This commit is contained in:
jleroy
2024-05-03 14:24:45 +02:00
2 changed files with 8 additions and 1 deletions

View File

@@ -4,6 +4,7 @@ import fr.eni.enchere.interceptor.UserInterceptor;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry; import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
import org.springframework.web.servlet.config.annotation.ViewControllerRegistry; import org.springframework.web.servlet.config.annotation.ViewControllerRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer; import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
@@ -26,4 +27,10 @@ public class MvcConfig implements WebMvcConfigurer {
registry.addInterceptor(userInterceptor); registry.addInterceptor(userInterceptor);
} }
@Override
public void addResourceHandlers(ResourceHandlerRegistry registry) {
registry.addResourceHandler("/images/**")
.addResourceLocations("classpath:/static/images/");
}
} }

View File

@@ -93,7 +93,7 @@ public class ArticleRepositoryImpl implements ArticleRepository {
if (maxMontantEnchere.isPresent()) { if (maxMontantEnchere.isPresent()) {
article.setPrixMaxEnchere(maxMontantEnchere.get()); article.setPrixMaxEnchere(maxMontantEnchere.get());
} }
String lienImgTest = "src//images/articles/" + article.getId() + ".jpg"; String lienImgTest = "/images/articles/" + article.getId() + ".jpg";
String lienImg; String lienImg;
if (fileService.fileExists(lienImgTest)){ if (fileService.fileExists(lienImgTest)){
lienImg = "/images/articles/" + article.getId() + ".jpg"; lienImg = "/images/articles/" + article.getId() + ".jpg";