Skip to content

Commit

Permalink
fix: AssetService Process ignores localized files
Browse files Browse the repository at this point in the history
  • Loading branch information
Cristian Vidmar committed Mar 31, 2022
1 parent 0b7b440 commit 346817a
Showing 1 changed file with 16 additions and 12 deletions.
28 changes: 16 additions & 12 deletions asset.go
Original file line number Diff line number Diff line change
Expand Up @@ -197,21 +197,25 @@ func (service *AssetsService) Process(spaceID string, asset *Asset) error {
var locale string
for k := range asset.Fields.Title {
locale = k
break
}
if asset.Fields.File[k].UploadURL == "" {
continue
}
path := fmt.Sprintf("/spaces/%s%s/assets/%s/files/%s/process", spaceID, getEnvPath(service.c), asset.Sys.ID, locale)
method := "PUT"

path := fmt.Sprintf("/spaces/%s%s/assets/%s/files/%s/process", spaceID, getEnvPath(service.c), asset.Sys.ID, locale)
method := "PUT"
req, err := service.c.newRequest(method, path, nil, nil)
if err != nil {
return err
}

req, err := service.c.newRequest(method, path, nil, nil)
if err != nil {
return err
version := strconv.Itoa(asset.Sys.Version)
req.Header.Set("X-Contentful-Version", version)
err = service.c.do(req, nil)
if err != nil {
return err
}
}

version := strconv.Itoa(asset.Sys.Version)
req.Header.Set("X-Contentful-Version", version)

return service.c.do(req, nil)
return nil
}

// Publish publishes the asset
Expand Down

0 comments on commit 346817a

Please sign in to comment.