Skip to content
This repository has been archived by the owner on Sep 7, 2023. It is now read-only.

Escaped quotes in Ergo string are output with a spurious \ #665

Closed
jeromesimeon opened this issue Oct 7, 2019 · 6 comments
Closed

Escaped quotes in Ergo string are output with a spurious \ #665

jeromesimeon opened this issue Oct 7, 2019 · 6 comments

Comments

@jeromesimeon
Copy link
Member

Describe the bug
When returning strings containing (escaped) quotes, they are returned with a spurious \.

To Reproduce
In ergotop try: return "This is a \" quote".

Expected behavior
Should return the same string as the input.

Screenshots

Screenshot 2019-10-07 at 8 46 29 AM

Desktop (please complete the following information):

  • OS: MacOS
  • Browser N/A
  • Version 0.20.*
@jeromesimeon jeromesimeon added Type: Bug 🐛 Something isn't working Good First Issue :octocat: Good for newcomers Range: Usability Hacktoberfest by DigitalOcean and DEV Difficulty: Medium labels Oct 7, 2019
@Shivansh2407
Copy link

please assign this to me

@Shivansh2407
Copy link

Thanks..Can you please specify which file needs this fix?

@jeromesimeon
Copy link
Member Author

@Shivansh2407 It certainly requires some investigation. I'm not even clear whether this is a compile-time or execution-time related problem. It might be worth trying the same thing with the JavaScript backend for comparison, since this could be a ergotop only issue.

@jeromesimeon
Copy link
Member Author

Some additional data point. The escaping seems to work fine on the JavaScript backend:

bash-3.2$ cat examples/helloworld/logic/logic.ergo 
namespace org.accordproject.helloworld

contract HelloWorld over TemplateModel {
  // Simple Clause
  clause helloworld(request : Request) : Response {
    return Response{ output: "Hello \"" ++ contract.name ++ "\" (" ++ request.input ++ ")" }
  }
}
bash-3.2$ ./packages/ergo-cli/index.js execute --template examples/helloworld --data examples/helloworld/data.json --request examples/helloworld/request.json 
{"clause":"orgXaccordprojectXhelloworldXHelloWorld","request":{"$class":"org.accordproject.helloworld.Request","input":"Accord Project"},"response":{"$class":"org.accordproject.helloworld.Response","output":"Hello \"Fred Blogs\" (Accord Project)","transactionId":"58f5f261-454e-40d2-8b50-dc40d8aa0641","timestamp":"2019-10-14T18:18:16.564Z"},"state":{"$class":"org.accordproject.cicero.contract.AccordContractState","stateId":"org.accordproject.cicero.contract.AccordContractState#1"},"emit":[]}

@jeromesimeon
Copy link
Member Author

Fixed in the 0.20 branch 39cc398

@jeromesimeon
Copy link
Member Author

Screenshot 2019-10-14 at 3 16 38 PM

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants