Skip to content

Commit

Permalink
Merge pull request #109 from minseok1015/dev
Browse files Browse the repository at this point in the history
feat : varchar(255)에 맞게 자르기
  • Loading branch information
minseok1015 authored Aug 17, 2024
2 parents 422bd43 + 4f39e44 commit 81655e3
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 14 deletions.
24 changes: 16 additions & 8 deletions src/main/java/store/itpick/backend/config/WebConfig.java
Original file line number Diff line number Diff line change
Expand Up @@ -39,12 +39,20 @@ public void addArgumentResolvers(List<HandlerMethodArgumentResolver> resolvers)
resolvers.add(getJwtHandlerArgumentResolver);
}

// @Override
// public void addCorsMappings(CorsRegistry registry) {
// registry.addMapping("/**")
// .allowedOrigins("https://itpick.netlify.app")
// .allowedMethods("GET", "POST", "PUT", "DELETE", "HEAD")
// .allowedHeaders("Authorization", "Content-Type")
// .allowCredentials(true);
// }


@Override
public void addCorsMappings(CorsRegistry registry) {
registry.addMapping("/**")
.allowedOriginPatterns("http://localhost:3000/", "http://localhost:5173/", "https://localhost:5173/",
"https://itpick.netlify.app")
.allowedMethods("GET", "POST", "PUT", "DELETE", "PATCH")
.exposedHeaders("location", "Authorization")
.allowedHeaders("*")
.allowCredentials(true);
}




}
19 changes: 13 additions & 6 deletions src/main/java/store/itpick/backend/service/SeleniumService.java
Original file line number Diff line number Diff line change
Expand Up @@ -290,11 +290,11 @@ private List<Reference> SearchReference(List<Keyword> keywords, List<String> lin

Reference reference=new Reference();

reference.setNewsTitle(newsTitle);
reference.setNewsContent(newsContent);
reference.setNewsLink(newsLink);
reference.setNewsImage(imageUrl);
reference.setSearchLink(searchLink);
reference.setNewsTitle(truncateContent(newsTitle));
reference.setNewsContent(truncateContent(newsContent));
reference.setNewsLink(truncateContent(newsLink));
reference.setNewsImage(truncateContent(imageUrl));
reference.setSearchLink(truncateContent(searchLink));

references.add(reference);
}catch (NoSuchElementException e){
Expand Down Expand Up @@ -400,7 +400,14 @@ public void processKeywordsAndReferences(String communityName, List<String> keyw
}
}


//글자수 자르기
private String truncateContent(String content) {
final int MAX_LENGTH = 250;
if (content.length() > MAX_LENGTH) {
return content.substring(0, MAX_LENGTH);
}
return content;
}



Expand Down

0 comments on commit 81655e3

Please sign in to comment.