Skip to content
This repository has been archived by the owner on Dec 15, 2022. It is now read-only.

Commit

Permalink
Merge 755bacb into 71c1781
Browse files Browse the repository at this point in the history
  • Loading branch information
Tilde Ann Thurium committed Aug 24, 2018
2 parents 71c1781 + 755bacb commit 30f94ca
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lib/controllers/file-patch-controller.js
Expand Up @@ -37,7 +37,7 @@ export default class FilePatchController extends React.Component {

static buildURI(relPath, workdir, stagingStatus) {
return 'atom-github://file-patch/' +
relPath +
encodeURIComponent(relPath) +
`?workdir=${encodeURIComponent(workdir)}` +
`&stagingStatus=${encodeURIComponent(stagingStatus)}`;
}
Expand Down
12 changes: 12 additions & 0 deletions test/controllers/file-patch-controller.test.js
Expand Up @@ -96,6 +96,18 @@ describe('FilePatchController', function() {

getFilePatchForPath = sinon.stub(repository, 'getFilePatchForPath');
});
describe('buildURI', function() {
it('correctly uri encodes all components', function() {
const filePathWithSpecialChars = '???.txt';
const stagingStatus = 'staged';
const URI = FilePatchController.buildURI(filePathWithSpecialChars, workdirPath, stagingStatus);
assert.isTrue(URI.includes(encodeURIComponent(filePathWithSpecialChars)));
assert.isTrue(URI.includes(encodeURIComponent(workdirPath)));
assert.isTrue(URI.includes(encodeURIComponent(stagingStatus)));
});

});


describe('when the FilePatch is too large', function() {
it('renders a confirmation widget', async function() {
Expand Down

0 comments on commit 30f94ca

Please sign in to comment.