Skip to content

Commit

Permalink
commons codec is still needed
Browse files Browse the repository at this point in the history
  • Loading branch information
rbri committed Jan 2, 2025
1 parent e1203b4 commit 664fbdc
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
9 changes: 9 additions & 0 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -1204,6 +1204,10 @@
<artifactId>httpmime</artifactId>
<version>${httpcomponents.version}</version>
<exclusions>
<exclusion>
<groupId>commons-codec</groupId>
<artifactId>commons-codec</artifactId>
</exclusion>
<exclusion>
<groupId>commons-logging</groupId>
<artifactId>commons-logging</artifactId>
Expand Down Expand Up @@ -1263,6 +1267,11 @@
<artifactId>commons-logging</artifactId>
<version>1.3.4</version>
</dependency>
<dependency>
<groupId>commons-codec</groupId>
<artifactId>commons-codec</artifactId>
<version>1.17.1</version>
</dependency>
<dependency>
<groupId>org.brotli</groupId>
<artifactId>dec</artifactId>
Expand Down
5 changes: 3 additions & 2 deletions src/main/java/org/htmlunit/protocol/data/DataUrlDecoder.java
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@
import java.nio.charset.Charset;
import java.nio.charset.IllegalCharsetNameException;
import java.nio.charset.UnsupportedCharsetException;
import java.util.Base64;

import org.apache.commons.codec.binary.Base64;
import org.apache.commons.lang3.StringUtils;
import org.htmlunit.util.MimeType;
import org.htmlunit.util.UrlUtils;
Expand Down Expand Up @@ -92,7 +92,8 @@ public static DataUrlDecoder decodeDataURL(final String url) throws UnsupportedE
byte[] data = url.substring(comma + 1).getBytes(charset);
data = UrlUtils.decodeDataUrl(data);
if (base64) {
data = Base64.getDecoder().decode(data);
// the commons codec decoder skip's invalid chars
data = Base64.decodeBase64(data);
}
return new DataUrlDecoder(data, mediaType, charset);
}
Expand Down

0 comments on commit 664fbdc

Please sign in to comment.