Skip to content

Commit

Permalink
Update TableModel.java
Browse files Browse the repository at this point in the history
  • Loading branch information
f0ng authored Mar 21, 2022
1 parent d203c18 commit 0189e61
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/main/java/ui/model/TableModel.java
Original file line number Diff line number Diff line change
Expand Up @@ -59,11 +59,14 @@ public Object getValueAt(int row, int column) {
case 0:
String strr = new String(captcha.getImage());
if ( (strr.contains("data:image") && !strr.startsWith("data:image")) || (strr.contains("data%3Aimage") && !strr.startsWith("data%3Aimage")) ){
String pattern = "(data:image.*?)[\"|&]|(data%2Aimage.*?)[\"|&]";
String pattern = "(data:image.*?)[\"|&]|(data%2Aimage.*?)[\"|&]|([B|b]ase64\".*)[\"|&]";
Pattern r = Pattern.compile(pattern);
Matcher m = r.matcher(strr);
if (m.find( )) {
strr = m.group(0).replace("\"","").replace("&","") ;
strr = m.group(0).replace("\"","").replace("&","").replace("Base64:","").replace("base64:","") ;
}
if (!strr.contains("data:image")){
strr = "data:image/jpeg;base64," + strr;
}
byte[] byteImage = DatatypeConverter.parseBase64Binary(strr.substring(strr.indexOf(",") + 1));
ImageIcon icon = byte2img(byteImage);
Expand Down

0 comments on commit 0189e61

Please sign in to comment.