Skip to content

Commit

Permalink
Merge pull request #394 from SockDrawer/fix-matching-images
Browse files Browse the repository at this point in the history
fix(Commands): Fix for images being seen as commands
  • Loading branch information
AccaliaDeElementia authored Dec 10, 2016
2 parents da730a6 + c9b6d25 commit 7b125d2
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lib/commands.js
Original file line number Diff line number Diff line change
Expand Up @@ -637,7 +637,7 @@ exports.bindCommands = function bindCommands(forum) {
args.shift();
commandText = args.shift();
mention = true;
} else if (/^!\S{3,}(\s|$)/.test(line)) {
} else if (/^!\w\S{2,}(\s|$)/.test(line)) {
args = line.split(/\s+/);
commandText = args.shift().substring(1);
mention = false;
Expand Down
3 changes: 3 additions & 0 deletions test/lib/commandsTest.js
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,9 @@ describe('lib/config', () => {
it('should not match really short command', () => {
expect(parseLine('!c text stuff')).to.equal(null);
});
it('should not match non-letters after !', () => {
expect(parseLine('![0_1481227127790_upload.png]')).to.equal(null);
});
it('should match bare command', () => {
parseLine('!help').command.should.equal('help');
});
Expand Down

0 comments on commit 7b125d2

Please sign in to comment.