[HOTFIX] of HOTFIX: Use CanonicalPath for check
This commit is contained in:
		@ -101,10 +101,12 @@ public class ShopArticleController {
 | 
			
		||||
                                    @PathVariable("id") Long id
 | 
			
		||||
    ) throws IOException {
 | 
			
		||||
        Article article = articleRepository.findArticleById(id);
 | 
			
		||||
        
 | 
			
		||||
 | 
			
		||||
        if(article.image != null) {
 | 
			
		||||
            File file = new File(article.image.path);
 | 
			
		||||
            if (file.getCanonicalPath().startsWith("./data/img/")) {
 | 
			
		||||
            File allowedPath = new File("./data/img/");
 | 
			
		||||
 | 
			
		||||
            if (file.getCanonicalPath().startsWith(allowedPath.getCanonicalPath())) {
 | 
			
		||||
                InputStream in = new FileInputStream(file);
 | 
			
		||||
                response.setContentType(MediaType.IMAGE_JPEG_VALUE);
 | 
			
		||||
                IOUtils.copy(in, response.getOutputStream());
 | 
			
		||||
 | 
			
		||||
		Reference in New Issue
	
	Block a user