Trim trailing slash from AIGW URL

What does this MR do and why?

This fixes errors that occur when the URL is joined to a path that starts with a slash, for example "#{base_url}/v1/search/gitlab-docs".

Previously, if the AIGW URL ended with a slash, classic Duo Chat would fail with an A9999 error because the AIGW would return a 404 error for a URL with 2 slashes.

Note that the Admin UI trims trailing slashes when the AIGW URL is entered, but that doesn't apply when the AIGW URL is entered via rails console, as Amazon Q customers are instructed to do.

References

How to set up and validate locally

  1. In rails console, enter the AIGW URL with a trailing slash

    Ai::Setting.instance.update!(ai_gateway_url: "http://gdk.test:5052/")
  2. Ask Classic Duo Chat a question.

Previously, this would return an A9999 error

MR acceptance checklist

Evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.

Edited by Mark Lapierre

Merge request reports

Loading