@@ -207,8 +207,13 @@ func (r runner) run(_ *cobra.Command, args []string) error {
207207 }
208208 }
209209
210+ cleanImageName , err := cleanImageReference (args [0 ])
211+ if err != nil {
212+ return nil
213+ }
214+
210215 return eventLoop (
211- sbomExecWorker (args [ 0 ] , r .client , platform , writer ),
216+ sbomExecWorker (cleanImageName , r .client , platform , writer ),
212217 setupSignals (),
213218 eventSubscription ,
214219 stereoscope .Cleanup ,
@@ -249,13 +254,13 @@ func generateSBOM(src *source.Source) (*sbom.SBOM, error) {
249254 return & s , nil
250255}
251256
252- func sbomExecWorker (userInput string , dockerCli command.Cli , platform * image.Platform , writer sbom.Writer ) <- chan error {
257+ func sbomExecWorker (imageName string , dockerCli command.Cli , platform * image.Platform , writer sbom.Writer ) <- chan error {
253258 errs := make (chan error )
254259 go func () {
255260 defer close (errs )
256261
257262 provider := stereoscopeDocker .NewProviderFromDaemon (
258- userInput ,
263+ imageName ,
259264 file .NewTempDirGenerator (internal .ApplicationName ),
260265 dockerCli .Client (),
261266 platform ,
@@ -267,19 +272,19 @@ func sbomExecWorker(userInput string, dockerCli command.Cli, platform *image.Pla
267272 }
268273 }()
269274 if err != nil {
270- errs <- fmt .Errorf ("failed to fetch the image %q: %w" , userInput , err )
275+ errs <- fmt .Errorf ("failed to fetch the image %q: %w" , imageName , err )
271276 return
272277 }
273278
274279 err = img .Read ()
275280 if err != nil {
276- errs <- fmt .Errorf ("failed to read the image %q: %w" , userInput , err )
281+ errs <- fmt .Errorf ("failed to read the image %q: %w" , imageName , err )
277282 return
278283 }
279284
280- src , err := source .NewFromImage (img , userInput )
285+ src , err := source .NewFromImage (img , imageName )
281286 if err != nil {
282- errs <- fmt .Errorf ("failed to construct source from user input %q: %w" , userInput , err )
287+ errs <- fmt .Errorf ("failed to construct source from user input %q: %w" , imageName , err )
283288 return
284289 }
285290 src .Exclusions = appConfig .Exclusions
0 commit comments