[1Ramp Alpha Web App] - Error occurs when post submitted with same title used in previous post (Permlink characters)

View this thread on: d.buzz | hive.blog | peakd.com | ecency.com
·@tobias-g·
0.000 HBD
[1Ramp Alpha Web App] - Error occurs when post submitted with same title used in previous post (Permlink characters)
#### Project Information

1. Repository: https://github.com/hapramp/alpha-web
2. Project Name: 1Ramp Alpha Web App
3. Publisher (if applicable): @singhpratyush
 
#### Expected behavior

A user should be able to make a post with the same title as a previously created post and the application (1ramp Web) should be able to cater to this and submit the post to the blockchain.

#### Actual Behaviour

When a user attempts to submit a post with a title that has already been used previously, the application will throw an error. When you create a post with the same title the application prepends the current date & time to the permlink, however, the timestamp is causing an error upon submission to the blockchain via Steem Connect.

#### Steps to reproduce

1. Go to https://alpha.1ramp.io/feed/

2. Sign in using your Steem Account

3. Using the create the new article option shown within the floating menu, create a post with the title of "This is a title" and the body of "This is the body", select any category and add a tag of "test". Note that the category, body, and tag have no effect on the outcome of these tests.

4. Submit your post to the blockchain.

5. Wait 5 minutes (you can only post every 5 minutes) and then repeat steps 3 & 4.

6. Note that the platform will state that an error has occurred.
 
#### Environment

- Browser: Google Chrome (Version 65.0.3325.162 (Official Build) (64-bit))
- Device: MacBook Pro (Retina, 15-inch, Late 2013)
- Operating system: MacOS HighSierra Version 10.13

#### Issues Details  
  
Upon submitting the first post, the request payload is as follows:  

```
{"operations":[["comment",{"parent_author":"","parent_permlink":"hapramp","author":"votezilla","permlink":"this-is-a-title","title":"this is a title","body":"<p>this is a body</p>\n\n  <div id=\"1ramp-footer\" />\n  <hr>\n  <center>\n  <h4>\n  <a href=\"https://1ramp.io\">\n  <img src=\"https://ipfs.busy.org/ipfs/QmTFN4mf55SRZkP8Ug7jXVP3sXAmH7sd35zMNwLFpgGqNU\"/>\n  </a>\n  <br>\n  See this post on <a href=\"https://play.google.com/store/apps/details?id=com.hapramp\">1Ramp Android</a> and <a href=\"https://alpha.1ramp.io/@votezilla/this-is-a-title\">Web</a>.\n  </h4>\n  </center>","json_metadata":"{\"tags\":[\"hapramp\",\"hapramp-design\",\"design\"],\"app\":\"hapramp/0.0.16\"}"}]]}
```
This created the following post: https://alpha.1ramp.io/@votezilla/this-is-a-title

When attempting to submit a post with the same title, the following errors are shown within the console:

##### Error 1

```
steemconnect.com/api/broadcast:1
Failed to load resource: the server responded with a status of 500 ()
```
##### Error 2

```
actions.js:86 [CREATE POST ERROR] Error: sc2-sdk error

at o.p [as _captureStackTrace] (bluebird.js:1068)

at o._resolveFromExecutor (bluebird.js:3246)

at new o (bluebird.js:2845)

at Object.createPost (steem.js:341)

at Object.<anonymous> (actions.js:69)

at r (runtime.js:62)

at Generator._invoke (runtime.js:296)

at Generator.e.(anonymous function) [as next] (https://alpha.1ramp.io/static/js/main.3492e6e4.js:1:1732164)

at r (main.3492e6e4.js:56758)

at main.3492e6e4.js:56758

```

Within the response from SteemConnect the following error is provided:

```
{"error":"server_error","error_description":"false: Invalid permlink character: T"}
```


The following request payload was used in the above request:

```
{"operations":[["comment",{"parent_author":"","parent_permlink":"hapramp","author":"votezilla","permlink":"20181202T132132047Z-this-is-a-title","title":"this is a title","body":"<p>this is a body</p>\n\n <div id=\"1ramp-footer\" />\n <hr>\n <center>\n <h4>\n <a href=\"https://1ramp.io\">\n <img src=\"https://ipfs.busy.org/ipfs/QmTFN4mf55SRZkP8Ug7jXVP3sXAmH7sd35zMNwLFpgGqNU\"/>\n </a>\n <br>\n See this post on <a href=\"https://play.google.com/store/apps/details?id=com.hapramp\">1Ramp Android</a> and <a href=\"https://alpha.1ramp.io/@votezilla/20181202T132132047Z-this-is-a-title\">Web</a>.\n </h4>\n </center>","json_metadata":"{\"tags\":[\"hapramp\",\"hapramp-design\",\"design\"],\"app\":\"hapramp/0.0.16\"}"}]]}
```

If you compare the request payload for both of the posts, you can see that when you attempt to create a post that has the same title as a previously created post, a time stamp is being prepended to the permlink. Once the time stamp has been prepended to the permlink, the permlink should then be lowercased using `toLowerCase()` as currently the error provided relates to one of the uppercase characters within the timestamp.

#### Recording of Issue

The following issue can be seen in the view below:

<iframe width="560" height="315" src="https://www.youtube.com/embed/xL4HQonsKB0" frameborder="0" allow="accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe>

#### GitHub Account

A link to my GitHub account can be found below:

https://github.com/tobias-g1

The issue was submitted to the repository here: 

https://github.com/hapramp/alpha-web/issues/81

and resolved by the project owner in the following pull request:

https://github.com/hapramp/alpha-web/pull/82
👍 , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , ,