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

json.url method returned url encoded the '#' #964

Open
CasparZheng opened this issue May 26, 2018 · 1 comment
Open

json.url method returned url encoded the '#' #964

CasparZheng opened this issue May 26, 2018 · 1 comment

Comments

@CasparZheng
Copy link

What did you do?

let jsonObj = JSON.init(rawValue: "https://store.insta360.com/accessory#commodity")
let commonUrl = jsonObj.url
print(commonUrl)

What did you expect to happen?

//print result:
https://store.insta360.com/accessory#commodity

What actually happened instead?

returned result encode the '#' to '%23', '#' is a keyword in url semantic, it means tag. it should not be encoded.

//print result:
https://store.insta360.com/accessory%23commodity

Environment

List the software versions you're using:

  • SwiftyJSON: 4.1.0
  • Xcode Version: 9.3 (9E145) (Open Xcode; In menubar: Xcode > About Xcode)
  • Swift Version: Xcode Default (Open Xcode Preferences; Components > Toolchains. If none, use Xcode Default.)

Please also mention which package manager you used and its version. Delete the
other package managers in this list:

  • Carthage: 0.29.0 (Use carthage version in Terminal)

Project that demonstrates the issue

Please link to a project we can download that reproduces the issue. Feel free
to delete this section if it's not relevant to the issue (eg - feature request).

The project should be short, self-contained, and correct example.

just test the url : "https://store.insta360.com/accessory#commodity", if encode to "https://store.insta360.com/accessory%23commodity" will get 404 in http protocol

@CasparZheng CasparZheng mentioned this issue May 26, 2018
4 tasks
@anton-plebanovich
Copy link

Have the same issue. Query escaping encoding shouldn't be applied to whole URL and instead to query only. Probably it should support all available encodings: urlUserAllowed urlPasswordAllowed urlHostAllowed urlPathAllowed urlQueryAllowed urlFragmentAllowed. Or at least some of them.

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

No branches or pull requests

2 participants