Skip to content

fix: fixed how refresh button url is constructed, it did not respect …#217

Merged
VahidN merged 1 commit intoVahidN:masterfrom
gatis-ozols:fix-refresh-button-url-issue
Aug 19, 2025
Merged

fix: fixed how refresh button url is constructed, it did not respect …#217
VahidN merged 1 commit intoVahidN:masterfrom
gatis-ozols:fix-refresh-button-url-issue

Conversation

@gatis-ozols
Copy link

…the value of options.CaptchaImageControllerNameTemplate like Image url did.

I extracted controller name extraction to separate method GetControllerName that is used in both places.

…the value of options.CaptchaImageControllerNameTemplate like Image url did.

I extracted controller name extraction to separate method GetControllerName that is used in both places.
Copy link

@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.

Summary of Changes

Hello @gatis-ozols, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request addresses a bug where the refresh button's URL construction did not correctly utilize the CaptchaImageControllerNameTemplate option, unlike the image URL. To resolve this, a new private helper method, GetControllerName, has been introduced to centralize the logic for extracting the controller name, ensuring consistency across both image and refresh button URL generation.

Highlights

  • Bug Fix: Corrected an issue where the refresh button's URL did not respect the options.CaptchaImageControllerNameTemplate setting.
  • Code Refactoring: Extracted the logic for determining the captcha image controller name into a new private method, GetControllerName().
  • Improved Consistency: Ensured that both the captcha image URL and the refresh button URL now consistently use the GetControllerName() method, adhering to the configured controller name template.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point in your pull request via creating an issue comment (i.e. comment on the pull request page) using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in issue comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

@what-the-diff
Copy link

what-the-diff bot commented Aug 19, 2025

PR Summary

  • Introduction of New Private Method
    A new private method titled GetControllerName() has been introduced. This method will pull the name of the controller and provide the option to customize the template.

  • Code Refactoring for Efficiency
    The existing code has been refactored. Now, the GetControllerName() method is being used within the GetCaptchaImageTagBuilder and GetRefreshButtonTagBuilder methods. This change removed redundant logic, thus making the software more efficient and easier to maintain.

Copy link

@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

This pull request correctly fixes an issue where the refresh button's URL was not using the CaptchaImageControllerNameTemplate option. The introduction of the GetControllerName method is a good refactoring that removes code duplication. I have one minor suggestion to improve the implementation of this new method for better clarity.

Comment on lines +197 to +205
var controllerName = nameof(DNTCaptchaImageController)
.Replace(oldValue: "Controller", string.Empty, StringComparison.Ordinal);

if (!string.IsNullOrEmpty(_captchaOptions.CaptchaImageControllerNameTemplate))
{
controllerName = _captchaOptions.CaptchaImageControllerNameTemplate;
}

return controllerName;

Choose a reason for hiding this comment

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

medium

While the current implementation is functionally correct, it can be simplified for better readability. Using an early return pattern makes the logic more direct: it first checks for a custom template and uses it if available, otherwise it falls back to the default. This avoids reassigning the controllerName variable and makes the code's intent clearer.

        if (!string.IsNullOrEmpty(_captchaOptions.CaptchaImageControllerNameTemplate))
        {
            return _captchaOptions.CaptchaImageControllerNameTemplate;
        }

        return nameof(DNTCaptchaImageController)
            .Replace(oldValue: "Controller", string.Empty, StringComparison.Ordinal);

Copy link
Owner

Choose a reason for hiding this comment

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

Commit suggestion

Copy link
Owner

Choose a reason for hiding this comment

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

/fix

Copy link
Owner

Choose a reason for hiding this comment

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

/fix

@VahidN VahidN merged commit 2fc79e8 into VahidN:master Aug 19, 2025
0 of 2 checks passed
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