Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Add percentencoding to special character + #108

Merged
merged 3 commits into from Sep 4, 2019

Conversation

harish1992
Copy link
Contributor

@harish1992 harish1992 commented Aug 27, 2019

As documented in CouchDB issues apache/couchdb#2144 and apache/couchdb#1830 creation of documents and attachments with unescaped + in id and attachment name is possible but requires them to be percentencoded while retrieving.

This PR provides a workaround to the issue #104 by percentencoding + and hence allowing creation,retrieval,updation and deletion of documents with + in their ids.

This change requires an update to Kitura-NIO 2.2 to pick changes from PR (Kitura/Kitura-NIO#199) to work, and hence won't work for anyone using Kitura-NIO with Swift 4.

Description

Added static func escape(url: String) which takes customAllowedCharacterSet as argument to escape +

Motivation and Context

This PR provides a workaround to this issue by percentencoding + and hence
allow creation,retrieval,updation and deletion of documents with + in their
ids.

Fixes the issue #104 .

How Has This Been Tested?

Tested creation, retrieval, updation and deletion of CouchDb documents with + in their
id. Added Test case for creation, addition, retrieval and deletion of document attachments
+ in the attachment names.

Checklist:

  • I have submitted a CLA form
  • If applicable, I have updated the documentation accordingly.
  • If applicable, I have added tests to cover my changes.

As documented in CouchDB issues
creation of documents and attachments with unescaped `+` but requires it to be
percentencoded while retrieving.
This PR provides a workaround to this issue by percentencoding `+` and hence
allow creation,retrieval,updation and deletion of documents with `+` in their
ids.
Tests/CouchDBTests/credentials.json Outdated Show resolved Hide resolved
Tests/CouchDBTests/DocumentCrudTests.swift Outdated Show resolved Hide resolved
Sources/CouchDB/CouchDBUtils.swift Outdated Show resolved Hide resolved
@djones6
Copy link
Contributor

djones6 commented Sep 4, 2019

Travis setup does not allow PR builds to work from a fork; here's a link to Harish's personal Travis build for harish1992@d2b4042:
https://travis-ci.org/harish1992/Kitura-CouchDB/builds/580062021

Package.swift Show resolved Hide resolved
@djones6 djones6 changed the title [Workaround]Add percentencoding to special character + fix: Add percentencoding to special character + Sep 4, 2019
@djones6 djones6 merged commit 63cc919 into Kitura:master Sep 4, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants