Skip to content

Commit dc69bad

Browse files
Merge pull request #39 from eosdis-nasa/EDPUB-1246-fix-special-char-issues
EDPUB-1246: Fix Special Characters in Notes
2 parents 5db0c20 + 8cf11e2 commit dc69bad

2 files changed

Lines changed: 4 additions & 8 deletions

File tree

CHANGELOG.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
77
and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).
88

99
## Unreleased
10-
10+
- Updated conversations text formatting to accommodate special characters
1111
- Fixed zindex on user creation page.
1212
- Removed funny line from dropdown
1313
- Added error page form and routes to it if an api return (response.error.code) not 200

app/src/js/components/Conversations/conversation.js

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,7 @@ import LoadingOverlay from '../LoadingIndicator/loading-overlay';
1717
const textRef = React.createRef();
1818

1919
const reply = (dispatch, id) => {
20-
const resp = textRef.current.value
21-
.replace(/\n/g, "\\n")
22-
.replace(/\t/g, '\\t')
23-
.replace(/\r/g, '\\r')
24-
.replace(/\"/g, '\\"');
20+
const resp = encodeURI(textRef.current.value);
2521
const payload = { conversation_id: id, text: resp };
2622
dispatch(replyConversation(payload));
2723
textRef.current.value = '';
@@ -140,7 +136,7 @@ const Conversation = ({ dispatch, conversation, privileges, match }) => {
140136
{
141137
notes.map((note, key) => {
142138
return (<Note note={note} key={key} />);
143-
}).reverse()
139+
})
144140
}
145141
</div>
146142
</section>
@@ -187,7 +183,7 @@ const Note = ({ note }) => {
187183
<h3>{ note.from.name }</h3>
188184
{lastUpdated(note.sent, 'Sent')}
189185
</div>
190-
<div className='flex__item--grow-1-wrap'>{ note.text }</div>
186+
<div className='flex__item--grow-1-wrap'style={{whiteSpace: "pre"}}>{ decodeURI(note.text) }</div>
191187
</div>
192188
);
193189
};

0 commit comments

Comments
 (0)