fix(postoffice): :bug: Ensure USD only gets texture, not HTML/CSS
Because the web codec now returns the HTML and CSS, the USD codec was unsure which of the files provided was the image it should be using as a texture. This is now fixed!
···124124func (c codec) Encode(pc types.Postcard, opts *formats.EncodeOptions) ([]formats.FileWriter, error) {
125125 usdFilename := pc.Name + extension
126126127127- // Grab the filename of the texture image, as it might be JPG or PNG
128128- webImg, _ := web.Codec("jpeg", "png")
127127+ if opts == nil {
128128+ opts = &formats.EncodeOptions{}
129129+ }
129130 // We can scrub the transparency data (it's represented in mesh points)
130131 // And make a significantly smaller (JPEG powered) texture.
131132 // We must not do this for archival requests, as it loses the transparency data forever.
132133 opts.NoTransparency = !opts.WantsLossless()
134134+ opts.IncludeSupportFiles = false
135135+136136+ webImg, _ := web.Codec("jpeg", "png")
133137 fws, err := webImg.Encode(pc, opts)
134138 if err != nil {
135139 return nil, err
136140 }
137141138138- if len(fws) != 1 {
142142+ switch len(fws) {
143143+ case 1:
144144+ // All good
145145+ case 0:
139146 return nil, fmt.Errorf("couldn't encode postcard textures")
147147+ default:
148148+ return nil, fmt.Errorf("unable to determine web image file writer")
140149 }
141150 fw := fws[0]
142151