diff --git a/worker/preparegspatialjp/command.go b/worker/preparegspatialjp/command.go index 617edcf1d..a5a8ef3df 100644 --- a/worker/preparegspatialjp/command.go +++ b/worker/preparegspatialjp/command.go @@ -285,8 +285,11 @@ func notifyError(ctx context.Context, c *cms.CMS, cityItemID string, citygmlErro } } - var rawItem *cms.Item - cms.Marshal(item, rawItem) + var rawItem cms.Item + cms.Marshal(item, &rawItem) + if rawItem.ID == "" { + return fmt.Errorf("failed to marshal item") + } if _, err := c.UpdateItem(ctx, rawItem.ID, rawItem.Fields, rawItem.MetadataFields); err != nil { return fmt.Errorf("failed to update item: %w", err) diff --git a/worker/preparegspatialjp/file.go b/worker/preparegspatialjp/file.go index 8ff915ffc..d361bc8e7 100644 --- a/worker/preparegspatialjp/file.go +++ b/worker/preparegspatialjp/file.go @@ -61,6 +61,15 @@ func Unzip(ctx context.Context, zipFile *bytes.Reader, targetDir string, trimPat return fmt.Errorf("invalid file path: %s", filePath) } + if strings.HasPrefix(filePath, "__MACOSX/") || + strings.HasPrefix(filePath, "/__MACOSX/") || + strings.HasSuffix(filePath, "/.DS_Store") || + strings.HasSuffix(filePath, "/Thumb.db") || + filePath == ".DS_Store" || filePath == "Thumbs.db" { + log.Debugf("skipping %s...", f.Name) + continue + } + log.Infofc(ctx, "unzipping %s -> %s", f.Name, filePath) if trimPathSuffix != "" {