@@ -145,19 +145,18 @@ func (a *analysisOrchestrator) CreateWorkspace(ctx context.Context, orgId string
145
145
return "" , fmt .Errorf ("target is nil" )
146
146
}
147
147
148
- repositoryTarget , ok := target .(* scan.RepositoryTarget )
149
- if ! ok || repositoryTarget .GetRepositoryUrl () == "" {
150
- err := fmt .Errorf ("workspace is not a repository, cannot scan" )
151
- a .errorReporter .CaptureError (err , observability.ErrorReporterOptions {ErrorDiagnosticPath : target .GetPath ()})
152
- return "" , err
148
+ repositoryTargetPath := target .GetPath ()
149
+ var repositoryTargetURL string
150
+ if repositoryTarget , ok := target .(* scan.RepositoryTarget ); ok {
151
+ repositoryTargetPath , repositoryTargetURL = repositoryTarget .GetPath (), repositoryTarget .GetRepositoryUrl ()
153
152
}
154
153
155
154
host := a .host (true )
156
- a .logger .Info ().Str ("host" , host ).Str ("path" , repositoryTarget . GetPath ()) .Str ("repositoryUri" , repositoryTarget . GetRepositoryUrl () ).Msg ("creating workspace" )
155
+ a .logger .Info ().Str ("host" , host ).Str ("path" , repositoryTargetPath ) .Str ("repositoryUri" , repositoryTargetURL ).Msg ("creating workspace" )
157
156
158
157
workspace , err := workspaceClient .NewClientWithResponses (host , workspaceClient .WithHTTPClient (a .httpClient ))
159
158
if err != nil {
160
- a .errorReporter .CaptureError (err , observability.ErrorReporterOptions {ErrorDiagnosticPath : repositoryTarget . GetPath () })
159
+ a .errorReporter .CaptureError (err , observability.ErrorReporterOptions {ErrorDiagnosticPath : repositoryTargetPath })
161
160
return "" , fmt .Errorf ("failed to connect to the workspace API %w" , err )
162
161
}
163
162
@@ -195,7 +194,7 @@ func (a *analysisOrchestrator) CreateWorkspace(ctx context.Context, orgId string
195
194
WorkspaceType workspaces.WorkspacePostRequestDataAttributesWorkspaceType
196
195
}{
197
196
BundleId : bundleHash ,
198
- RepositoryUri : repositoryTarget . GetRepositoryUrl () ,
197
+ RepositoryUri : repositoryTargetURL ,
199
198
WorkspaceType : "file_bundle_workspace" ,
200
199
RootFolderId : target .GetPath (),
201
200
}),
0 commit comments