Discussion turns everything after a link into part of the link

Open Beginner friendly
#2,404 0 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
78/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Active
Tech stack
typescript
Domain
frontend

Research direction

The link pattern is urlMatcher in class-response.component.ts around line 51; its path group (\/.*)? runs to the end of the line, and the scheme is optional, so bare words like "roots.water" also match. Start by reading that regex and the code that applies it to post text, then reproduce with the example in the issue. Done when the link stops at whitespace, trailing punctuation is excluded, and the example sentence links only "example.com/page".

Written by the indexing model from the issue text.

Description

When a Discussion post or reply contains a web address followed by more text on the same line, the rest of the line becomes part of the link.

How to reproduce

As a student, post "See example.com/page for the data, I think it is wrong." The whole of "example.com/page for the data, I think it is wrong." is one link, and clicking it opens a page that does not exist.

Cause

The path part of urlMatcher in class-response.component.ts (line 51) is (\/.*)?, which matches everything up to the end of the line. Two words joined by a period without a space, such as "roots.water", also become a link, since a scheme is optional and any 2 to 5 lowercase letters count as a top-level domain.

Possible fix

Limit the path to characters that cannot be whitespace, for example (\/[^\s<]*)?, and drop trailing punctuation from the match.

Dominant language
TypeScript
Stars
4
Forks
8
Avg merge
3d 8h
Merged PRs (30d)
12

Getting set up

  • Ships a Dockerfile or Docker Compose file
  • Has a pull request template
  • No contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from WISE-Community/WISE-Client

All issues in WISE-Community/WISE-Client

Similar issues

More TypeScript issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.