Skip to content

Commit

Permalink
Correctly unescape IMG URLs
Browse files Browse the repository at this point in the history
  • Loading branch information
radkovo committed Mar 24, 2017
1 parent 5d18421 commit 4c26b6f
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/main/java/org/fit/cssbox/layout/HTMLBoxFactory.java
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@

import java.awt.Graphics2D;
import java.io.IOException;
import java.io.UnsupportedEncodingException;
import java.net.MalformedURLException;
import java.net.URL;
import java.net.URLDecoder;
Expand Down Expand Up @@ -141,7 +142,13 @@ protected ElementBox createSubtreeImg(ElementBox parent, Element e, Viewport vie
rbox.setViewport(viewport);
rbox.setStyle(style);

String src = HTMLNorm.getAttribute(e, "src");
String src;
try
{
src = URLDecoder.decode(HTMLNorm.getAttribute(e, "src"), "UTF-8");
} catch (UnsupportedEncodingException e1) {
src = "";
}
rbox.setContentObj(new ReplacedImage(rbox, rbox.getVisualContext(), factory.getBaseURL(), src));

if (rbox.isBlock())
Expand Down

0 comments on commit 4c26b6f

Please sign in to comment.