Giter VIP home page Giter VIP logo

imgix-java's Issues

URLHelper is calling platform dependent String.getBytes()

URLHelper is calling platform dependent String.getBytes() here:

private String encodeBase64(String str) {
	byte[] stringBytes = str.getBytes();

But as far as I know base64 encoding for urls require UTF-8 to be used and should be specified explicitly here.

Running this example program:

public class ImgixExample {
    public static void main(String[] args) {
        System.out.println("Default charset: " + Charset.defaultCharset());
        URLBuilder builder = new URLBuilder("demos.imgix.net");
        Map<String, String> params = new HashMap<String, String>();
        params.put("m64", "http://demos.imgix.net/bridge.png?ixlib=java-2.1.0");
        System.out.println(builder.createURL("bridge.png", params));
    }
}

with -Dfile.encoding=UTF-8 and -Dfile.encoding=UTF-32 respectively demonstrates the problem:

Default charset: UTF-8
http://demos.imgix.net/bridge.png?ixlib=java-2.1.0&m64=aHR0cDovL2RlbW9zLmltZ2l4Lm5ldC9icmlkZ2UucG5nP2l4bGliPWphdmEtMi4xLjA
Default charset: UTF-32
http://demos.imgix.net/bridge.png?ixlib=java-2.1.0&m64=�������������������������������������������������������������������

Undocumented behavior: path provided to createURL must be doubly url-encoded

Unlike the javascript API, the java API forces you to double url-encode the source URL path provided to createURL.

Steps to reproduce:

  • Have a file located at https://my.domain/project:1/blah.jpg
  • URL-encode it once, so that it becomes https://my.domain/project%3A1/blah.jpg
  • Use HTTPBuilder.createURL to create an imgix URL against your imgix domain.
  • Attempt to curl that URL, see that it fails.
  • generate another URL by doubly-encoding: builder.createURL(java.net.URLEncoder.encode("https://my.domain/project%30A1/blah.jpg", "UTF-8"), params)
  • Attempt to curl that URL, see that it succeeds.

Expected behavior:

  • I expect that I can pass a valid, singly encoded URL into createURL and get a valid imgix URL out.

Library; not included in Android: javax.xml.bind

Hi! first of all, thanks for this great library.

I'm trying to implement ImgIx on android app and I'm getting the following warning:

Invalid package reference in library; not included in Android: javax.xml.bind. Referenced from com.imgix.URLHelper.

I tried adding this rule to proguard without success

-dontwarn javax.xml.**

Publish sources JAR and javadoc JAR

Please also publish sources JAR and javadoc JAR, not just binary JAR.

In Maven you simply do source:jar javadoc:jar before deploy. Should have same feature in Gradle.

Thank you.

CVE in Java SDK

Hello,

There is a published CVE in the Java SDK affecting the latest version too. The CVE is https://nvd.nist.gov/vuln/search/results?form_type=Advanced&results_type=overview&search_type=all&cpe_vendor=cpe%3A%2F%3Aimgix&cpe_product=cpe%3A%2F%3Aimgix%3Aimgix&cpe_version=cpe%3A%2F%3Aimgix%3Aimgix%3A2.3.0

Also attched is the screengrab from my development machine detailing the CVE.

Are there any plans to fix this in a future update ?

Thank you for your attention.
Screenshot 2020-07-12 at 12 25 06

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.