This is an automated email from the ASF dual-hosted git repository.
abeizn pushed a commit to branch release-v0.18
in repository https://gitbox.apache.org/repos/asf/incubator-devlake.git
The following commit(s) were added to refs/heads/release-v0.18 by this push:
new 87b922c0e fix: sonarqube lastAnalysisDate string to iso8601Time (#5685)
87b922c0e is described below
commit 87b922c0ea19efafcebde165c57602523556d20d
Author: abeizn <[email protected]>
AuthorDate: Tue Jul 18 21:36:48 2023 +0800
fix: sonarqube lastAnalysisDate string to iso8601Time (#5685)
---
backend/plugins/sonarqube/api/scope.go | 16 ++++++++++++++++
1 file changed, 16 insertions(+)
diff --git a/backend/plugins/sonarqube/api/scope.go
b/backend/plugins/sonarqube/api/scope.go
index e31f36ddd..118a6af16 100644
--- a/backend/plugins/sonarqube/api/scope.go
+++ b/backend/plugins/sonarqube/api/scope.go
@@ -42,6 +42,22 @@ type ScopeReq api.ScopeReq[models.SonarqubeProject]
// @Failure 500 {object} shared.ApiBody "Internal Error"
// @Router /plugins/sonarqube/connections/{connectionId}/scopes [PUT]
func PutScope(input *plugin.ApiResourceInput) (*plugin.ApiResourceOutput,
errors.Error) {
+ // decode request body to scope, deal with lastAnalysisDate format
+ data := input.Body["data"].([]interface{})
+ for _, item := range data {
+ dateStr, ok :=
item.(map[string]interface{})["lastAnalysisDate"].(string)
+ if !ok {
+ continue
+ }
+ timeObj, err := api.ConvertStringToTime(dateStr)
+ if err != nil {
+ panic(err)
+ }
+
+ item.(map[string]interface{})["lastAnalysisDate"] = timeObj
+
+ }
+
return scopeHelper.Put(input)
}