Always stop at first whitespace

This commit is contained in:
Gert Goet
2023-02-11 18:03:02 +01:00
committed by William Casarin
parent f69e0c660a
commit bb9fc6f905
2 changed files with 3 additions and 3 deletions

View File

@@ -55,8 +55,8 @@ static int consume_until_whitespace(struct cursor *cur, int or_end) {
while (cur->p < cur->end) { while (cur->p < cur->end) {
c = *cur->p; c = *cur->p;
if (is_whitespace(c) && consumedAtLeastOne) if (is_whitespace(c))
return 1; return consumedAtLeastOne;
cur->p++; cur->p++;
consumedAtLeastOne = true; consumedAtLeastOne = true;

View File

@@ -141,7 +141,7 @@ class damusTests: XCTestCase {
} }
func testNoParseUrlWithOnlyWhitespace() { func testNoParseUrlWithOnlyWhitespace() {
let testString = "https:// " let testString = "https:// "
let parsed = parse_mentions(content: testString, tags: []) let parsed = parse_mentions(content: testString, tags: [])
XCTAssertNotNil(parsed) XCTAssertNotNil(parsed)