Issue #32 : Fixes getImageURIString to handle images with query parameters #33

Merged
merged 1 commit into from Aug 21, 2011

Projects

None yet

2 participants

@sripathikrishnan

One of my css files had a background image like this -
background : url(/image/with/query/parameters/image.png?a=b&c=d)

When I ran CSSEmbedder with a http url, the code skipped the image - even though its valid to specify query parameters in css images.

I verified the existing test cases, and added a couple two verify the above scenario.

@sripathikrishnan sripathikrishnan commented on the diff Aug 21, 2011
tests/net/nczonline/web/cssembed/CSSURLEmbedderTest.java
@@ -196,7 +196,7 @@ public class CSSURLEmbedderTest {
@Test
public void testReadFromAndWriteToSameFile() throws IOException {
- String filename = CSSURLEmbedderTest.class.getResource("samefiletest.css").getPath().replace("%20", " ");
+ String filename = this.getClass().getClassLoader().getResource("samefiletest.css").getPath().replace("%20", " ");
@sripathikrishnan
sripathikrishnan Aug 21, 2011

This was failing on my machine, and I presume on other machines as well. Since the image is at the root of the classpath, resolving it via the classloader will work okay on all machines

@nzakas nzakas merged commit 6111b05 into nzakas:master Aug 21, 2011
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment