GoSimplicity commented on PR #8608: URL: https://github.com/apache/incubator-devlake/pull/8608#issuecomment-3390468917
> ### Summary > What does this PR do? > > This PR fixes a case sensitivity issue in the Jira plugin's deployment type detection that caused API endpoint selection errors. The Jira API returns deployment types as "Cloud" or "Server" (capitalized), but the code was performing case-sensitive comparisons against lowercase constants, causing Jira Cloud instances to incorrectly use the deprecated v2 API endpoint instead of the v3 API. > > **Changes:** > > * Updated all Jira collectors to perform case-insensitive deployment type comparisons using `strings.ToLower()` > * Added missing `strings` import in `issue_collector.go` > * Added comprehensive unit tests to verify case-insensitive matching works for all variations > > **Files Modified:** > > * `backend/plugins/jira/tasks/account_collector.go` > * `backend/plugins/jira/tasks/epic_collector.go` > * `backend/plugins/jira/tasks/issue_changelog_collector.go` > * `backend/plugins/jira/tasks/issue_changelog_extractor.go` > * `backend/plugins/jira/tasks/issue_collector.go` > * `backend/plugins/jira/tasks/issue_comment_collector.go` > * `backend/plugins/jira/tasks/issue_comment_extractor.go` > * `backend/plugins/jira/tasks/issue_type_collector.go` > * `backend/plugins/jira/tasks/sprint_extractor.go` > * `backend/plugins/jira/tasks/deployment_type_test.go` (new) > > ### Does this close any open issues? > [Bug][Jira] V2 API removed #8563 Fixes the error: `The requested API has been removed. Please migrate to the /rest/api/3/search/jql API` when collecting Jira Cloud epics. > > This error occurred because the deployment type comparison was case-sensitive, causing Jira Cloud instances (which return "Cloud") to be treated as Jira Server and use the deprecated `/api/2/search` endpoint instead of `/api/3/search/jql`. > > ### Screenshots > N/A - This is a backend API endpoint selection fix. > > ### Other Information > * All tests pass successfully > * The fix ensures backward compatibility with any existing deployment type values > * Case-insensitive comparison handles: "Cloud", "cloud", "CLOUD", "Server", "server", "SERVER", etc. Thank you for the PR! However, during the testing process, I discovered a potential issue: Your code only converts the left side, which might cause "server" == "Server" to be false in all cases. If possible, please use strings.EqualFold instead. If needed, I would be more than happy to assist! -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
