@@ -218,7 +218,7 @@ type ContentProvider interface {
218218}
219219
220220// Export implements Exporter.
221- func Export (ctx context.Context , store ContentProvider , writer io.Writer , opts ... ExportOpt ) error {
221+ func Export (ctx context.Context , store content. Provider , writer io.Writer , opts ... ExportOpt ) error {
222222 var eo exportOptions
223223 for _ , opt := range opts {
224224 if err := opt (ctx , & eo ); err != nil {
@@ -231,13 +231,17 @@ func Export(ctx context.Context, store ContentProvider, writer io.Writer, opts .
231231 }
232232
233233 manifests := make ([]ocispec.Descriptor , 0 , len (eo .manifests ))
234- for _ , desc := range eo .manifests {
235- d , err := copySourceLabels (ctx , store , desc )
236- if err != nil {
237- log .G (ctx ).WithError (err ).WithField ("desc" , desc ).Warn ("failed to copy distribution.source labels" )
238- continue
234+ if infoProvider , ok := store .(content.InfoProvider ); ok {
235+ for _ , desc := range eo .manifests {
236+ d , err := copySourceLabels (ctx , infoProvider , desc )
237+ if err != nil {
238+ log .G (ctx ).WithError (err ).WithField ("desc" , desc ).Warn ("failed to copy distribution.source labels" )
239+ continue
240+ }
241+ manifests = append (manifests , d )
239242 }
240- manifests = append (manifests , d )
243+ } else {
244+ manifests = append (manifests , eo .manifests ... )
241245 }
242246
243247 algorithms := map [string ]struct {}{}
0 commit comments