Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Testcases containg certain characters break Touca #656

Open
darkuranium opened this issue Sep 27, 2023 · 1 comment
Open

Testcases containg certain characters break Touca #656

darkuranium opened this issue Sep 27, 2023 · 1 comment

Comments

@darkuranium
Copy link

Description

I have a testcase named #tag. Opening it directs me to /~/<team>/<suite>/<version>/%23tag, which (despite the # being URL-encoded) seems to confuse Touca, and redirect me to the login page (and ultimately, after re-logging in, to the Touca home page).

A similar issue happens with [*example*](https://example.com) (literal testcase name). It results in a "page not found" error in Touca; interestingly, the testcase itself links to a name with https:/ instead of https:// in the URL, which is likely the source of the problem.

Environment

Running Ubuntu 22.04.3 LTS, Touca v2.0.0 via Docker.

Steps To Reproduce

Problem 1:

  1. Create a testcase starting with the # character (e.g. #tag) and submit a test containing it.
  2. Try to open the testcase.
  3. You will be redirected to the login page.

Problem 2:

  1. Create a testcase named [*example*](https://example.com) and submit a test containing it.
  2. Try to open the testcase.
  3. You will get a "page not found" error. Note that the URL is going to end with [*example*](https:/example.com) (note the single slash!); manually attempting to fix it in the address bar will redirect to / (e.g. https://touca.example.com/), resulting in a blank page (not even an error!).

Expected Behavior

Clicking a testcase link should open the testcase as usual, instead of redirecting to the login page or failing to find the testcase.

Additional Context

There appears to be a similar problem with version links, but I don't have an exact reproducible example for them on hand. #xyz is a good guess at something that might fail.

@ghorbanzade
Copy link
Member

Thank you so much for reporting this bug, @darkuranium. I just tried both and managed to reproduce the issue(s). I think there are two problems here:

  • The web app does not properly encode/decode test case names.
  • The backend does not distinguish between test case name and test case slug (that is used in the URL and as an identifier for the test case).

Until these two issues get resolved (and I guess that it will take a while to fix these), it is safer to assume that testcase names should always be URL-friendly. So, as a workaround, could you try sanitizing the test case names before submitting your data? A basic implementation would be to replace special characters with _ in the test code for example.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants