Skip to content

fix: redirect url#3396

Merged
aaravgarg merged 1 commit intomainfrom
fix/redirect-url
Nov 8, 2025
Merged

fix: redirect url#3396
aaravgarg merged 1 commit intomainfrom
fix/redirect-url

Conversation

@krushnarout
Copy link
Copy Markdown
Member

No description provided.

@aaravgarg aaravgarg merged commit 52a778c into main Nov 8, 2025
1 check passed
@aaravgarg aaravgarg deleted the fix/redirect-url branch November 8, 2025 02:49
Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

The pull request aims to fix redirect URLs by adding a forward slash. However, this approach can lead to double slashes if the base URL already ends with one, which could cause issues. I've suggested a more robust way to construct the URLs using rstrip('/') to prevent this. I also pointed out that this URL construction logic is duplicated in several places and could be refactored for better maintainability.

raise HTTPException(status_code=500, detail="Todoist not configured")

redirect_uri = f'{base_url}v2/integrations/todoist/callback'
redirect_uri = f'{base_url}/v2/integrations/todoist/callback'
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

While adding the / fixes the issue when base_url is missing a trailing slash, it introduces a potential issue: if base_url does have a trailing slash, the resulting URL will have a double slash (e.g., http://host//v2/...). While many servers handle this gracefully, it's better to be more robust by ensuring there's always exactly one slash.

This pattern is repeated for all providers in this function (todoist, asana, google_tasks, clickup). You should apply this more robust approach for all of them. You could also consider refactoring this to define redirect_uri once before the if/elif block to reduce duplication.

Suggested change
redirect_uri = f'{base_url}/v2/integrations/todoist/callback'
redirect_uri = f'{base_url.rstrip("/")}/v2/integrations/todoist/callback'

return render_oauth_response(request, 'asana', success=False, error_type='config_error')

redirect_uri = f'{base_url}v2/integrations/asana/callback'
redirect_uri = f'{base_url}/v2/integrations/asana/callback'
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

Similar to my other comment, adding a hardcoded / can lead to double slashes (//) in the URL if base_url already has a trailing slash. Using rstrip('/') makes this more robust and prevents potential issues with the redirect URI.

Suggested change
redirect_uri = f'{base_url}/v2/integrations/asana/callback'
redirect_uri = f'{base_url.rstrip("/")}/v2/integrations/asana/callback'

return render_oauth_response(request, 'google_tasks', success=False, error_type='config_error')

redirect_uri = f'{base_url}v2/integrations/google-tasks/callback'
redirect_uri = f'{base_url}/v2/integrations/google-tasks/callback'
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

Similar to my other comments, adding a hardcoded / can lead to double slashes (//) in the URL if base_url already has a trailing slash. Using rstrip('/') makes this more robust and prevents potential issues with the redirect URI.

Suggested change
redirect_uri = f'{base_url}/v2/integrations/google-tasks/callback'
redirect_uri = f'{base_url.rstrip("/")}/v2/integrations/google-tasks/callback'

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

Successfully merging this pull request may close these issues.

2 participants