Skip to content
This repository has been archived by the owner on Apr 8, 2024. It is now read-only.

Commit

Permalink
fix(worker): ignore extra files in preparegeospatialjp
Browse files Browse the repository at this point in the history
  • Loading branch information
rot1024 committed Feb 6, 2024
1 parent bcd4c8c commit c4ed29e
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 2 deletions.
7 changes: 5 additions & 2 deletions worker/preparegspatialjp/command.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
9 changes: 9 additions & 0 deletions worker/preparegspatialjp/file.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 != "" {
Expand Down

0 comments on commit c4ed29e

Please sign in to comment.