GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — GenericUrl converts plus sign into space within URI path component · Issue #398 · googleapis/google-http-java-client

GenericUrl converts plus sign into space within URI path component #398

New issue
Copy link
New issue
Copy link
Closed
#913
Closed
GenericUrl converts plus sign into space within URI path component#398
#913
Copy link
Assignees
codyoss
Labels
🚨This issue needs some love.priority: p2Moderately-important priority. Fix may not be included in next release.status: blockedResolving the issue is dependent on other work.type: bugError or flaw in code with unintended results or allowing sub-optimal usage patterns.

Description

@vasiliy-bout
vasiliy-bout
opened on Feb 28, 2018
Issue body actions

This is a simple junit test which fails but should work according to https://tools.ietf.org/html/rfc3986#section-3.3 because + sign is allowed to be used within a path component and has no special meaning when used within a path component:

    @Test
    public void testGenericUrl() throws URISyntaxException {
        final URI uri = new URI("http://foo.bar/path+with+plus");

        final GenericUrl genericUrl = new GenericUrl(uri);

        Assert.assertEquals("/path+with+plus", genericUrl.getRawPath());
        Assert.assertEquals(ImmutableList.of("", "path+with+plus"), genericUrl.getPathParts());
    }

This bug is related to #255 but shows different behaviour. We are using google-http-client library version 1.23.0:

        <dependency>
            <groupId>com.google.http-client</groupId>
            <artifactId>google-http-client</artifactId>
            <version>1.23.0</version>
        </dependency>

From the first glance on sources, it looks like there is a bug inside toPathParts methods implementation on line 550: https://github.com/google/google-http-java-client/blob/110b3ab6fa7838dbe9926038427c712db9ed8aae/google-http-client/src/main/java/com/google/api/client/http/GenericUrl.java#L545-L553

There a call is made to CharEscapers.decodeUri which is invalid, because JavaDoc of this method explicitly states that it must not be used for path segments (see the second paragraph): https://github.com/google/google-http-java-client/blob/110b3ab6fa7838dbe9926038427c712db9ed8aae/google-http-client/src/main/java/com/google/api/client/util/escape/CharEscapers.java#L78-L90

Activity

  1. mattwhisenhunt commented on Mar 15, 2018

    @mattwhisenhunt
    mattwhisenhunt
    on Mar 15, 2018
    Contributor
    More actions

    You are exactly right about how and where this is broken.

    I'm marking that as wont-fix because the main purpose of this library is to connect to the 100+ Google APIs and other GenericURL unit tests seem to suggest that at least some of those APIs have non-conforming paths.

    @vasiliy-bout are you hitting this bug while connecting to one of the Google APIs?

  2. mattwhisenhunt
    added
    status: will not fix
    type: bugError or flaw in code with unintended results or allowing sub-optimal usage patterns.
    on Mar 15, 2018
  3. vasiliy-bout commented on Mar 16, 2018

    @vasiliy-bout
    vasiliy-bout
    on Mar 16, 2018 via email
    Author
    More actions
    No, we came across this bug while using the library to deal with other 3rd party HTTP APIs, so we will just ditch to a different library. I understand your reasons, but it looks a bit strange that Google HTTP APIs violates underlying standards... very much probably you also had reasons for this decision to keep violating them. I’d then suggest to at least document this non-conforming decision in the JavaDoc for the method, so that others will know about it before they came across this defect in production. What do you think?
  4. googleapis
    deleted a comment from rizarahman on Mar 28, 2018
  5. JustinBeckwith
    added
    priority: p2Moderately-important priority. Fix may not be included in next release.
    and removed
    status: will not fix
    on Jun 6, 2018
  6. JustinBeckwith
    added
    🚨This issue needs some love.
    on Aug 27, 2018
  7. chingor13
    self-assigned this
    on Aug 28, 2018
  8. google-admin
    unassigned
    chingor13
    on Sep 11, 2018
  9. ajaaym
    added a commit that references this issue on Dec 4, 2018

    fix googleapis#398 GenericUrl converts plus sign into space within UR…

    This issue will close once commit 3d8032f is merged into the 'master' branch.
    3d8032f
  10. ajaaym
    added
    status: will not fixInvalid (untrue/unsound/erroneous), inconsistent with product, not on roadmap.
    on Dec 10, 2018
  11. chingor13
    added
    status: blockedResolving the issue is dependent on other work.
    and removed
    status: will not fixInvalid (untrue/unsound/erroneous), inconsistent with product, not on roadmap.
    on Dec 13, 2018
  12. donghanmiao commented on Jun 19, 2019

    @donghanmiao
    donghanmiao
    on Jun 19, 2019
    More actions

    ping on this.

    Our Google CloudSearch Connectors SDK is having problem with this issue in at least on of our API
    https://developers.google.com/cloud-search/docs/reference/rest/v1/indexing.datasources.items/push

    when customer resource name contains '+', it was incorrectly converted into space.

  13. codyoss
    self-assigned this
    on Dec 10, 2019
  14. codyoss
    added 2 commits that reference this issue on Dec 10, 2019

    feat: decode uri path components correctly

    This issue will close once commit 81d3395 is merged into the 'master' branch.
    81d3395

    feat: decode uri path components correctly

    This issue will close once commit 875356d is merged into the 'master' branch.
    875356d
  15. chingor13
    closed this as completedin #913on Dec 17, 2019
  16. chingor13
    added a commit that references this issue on Dec 17, 2019

    feat: decode uri path components correctly (#913)

    This issue will close once commit 7d4a048 is merged into the 'main' branch.
    7d4a048
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

  • @codyoss
    codyoss

Labels

🚨This issue needs some love.priority: p2Moderately-important priority. Fix may not be included in next release.status: blockedResolving the issue is dependent on other work.type: bugError or flaw in code with unintended results or allowing sub-optimal usage patterns.

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

    You are visitor 01402775 — GeezerVison does not store the pages you look up.
    Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.