@@ -111,19 +111,17 @@ func (a *analysisOrchestrator) CreateWorkspace(ctx context.Context, orgId string
111
111
return "" , fmt .Errorf ("target is nil" )
112
112
}
113
113
114
- repositoryTarget , ok := target .(* scan.RepositoryTarget )
115
- if ! ok || repositoryTarget .GetRepositoryUrl () == "" {
116
- err := fmt .Errorf ("workspace is not a repository, cannot scan" )
117
- a .errorReporter .CaptureError (err , observability.ErrorReporterOptions {ErrorDiagnosticPath : target .GetPath ()})
118
- return "" , err
114
+ var repositoryTargetPath , repositoryTargetURL string
115
+ if repositoryTarget , ok := target .(* scan.RepositoryTarget ); ok {
116
+ repositoryTargetPath , repositoryTargetURL = repositoryTarget .GetPath (), repositoryTarget .GetRepositoryUrl ()
119
117
}
120
118
121
119
host := a .host (true )
122
- a .logger .Info ().Str ("host" , host ).Str ("path" , repositoryTarget . GetPath ()) .Str ("repositoryUri" , repositoryTarget . GetRepositoryUrl () ).Msg ("creating workspace" )
120
+ a .logger .Info ().Str ("host" , host ).Str ("path" , repositoryTargetPath ) .Str ("repositoryUri" , repositoryTargetURL ).Msg ("creating workspace" )
123
121
124
122
workspace , err := workspaceClient .NewClientWithResponses (host , workspaceClient .WithHTTPClient (a .httpClient ))
125
123
if err != nil {
126
- a .errorReporter .CaptureError (err , observability.ErrorReporterOptions {ErrorDiagnosticPath : repositoryTarget . GetPath () })
124
+ a .errorReporter .CaptureError (err , observability.ErrorReporterOptions {ErrorDiagnosticPath : repositoryTargetPath })
127
125
return "" , fmt .Errorf ("failed to connect to the workspace API %w" , err )
128
126
}
129
127
@@ -157,7 +155,7 @@ func (a *analysisOrchestrator) CreateWorkspace(ctx context.Context, orgId string
157
155
WorkspaceType workspaces.WorkspacePostRequestDataAttributesWorkspaceType
158
156
}{
159
157
BundleId : bundleHash ,
160
- RepositoryUri : repositoryTarget . GetRepositoryUrl () ,
158
+ RepositoryUri : repositoryTargetURL ,
161
159
WorkspaceType : "file_bundle_workspace" ,
162
160
}),
163
161
Type : "workspace" ,
0 commit comments