Diffstat (limited to 'internal/b2')
| -rw-r--r-- | internal/b2/client.go | 13 |
1 files changed, 4 insertions, 9 deletions
diff --git a/internal/b2/client.go b/internal/b2/client.go index 7b745a8..f2b6cad 100644 --- a/internal/b2/client.go +++ b/internal/b2/client.go @@ -33,14 +33,13 @@ func NewB2Client(cfg *config.B2Config) (*B2Client, error) { type BlogPage struct { Link string - FileName string Metadata *frontmatter.Metadata } -func (c *B2Client) Scan(prefix string) ([]*BlogPage, error) { +func (c *B2Client) Scan() ([]*BlogPage, error) { filePaths := []*BlogPage{} - iter := c.bucket.List(context.Background(), b2.ListPrefix(c.prefix+prefix)) + iter := c.bucket.List(context.Background(), b2.ListPrefix(c.prefix)) for iter.Next() { obj := iter.Object() @@ -70,13 +69,10 @@ func (c *B2Client) Scan(prefix string) ([]*BlogPage, error) { return nil, fmt.Errorf("failed to parse published time metadata field: %w", err) } - linkParts := strings.Split(obj.Name(), "/") - nameParts := strings.Split(linkParts[len(linkParts)-1], ".") - fileName := strings.Join(nameParts[:len(linkParts)-1], ".") + linkParts := strings.Split(obj.Name(), ".") filePaths = append(filePaths, &BlogPage{ - Link: obj.Name(), - FileName: fileName, + Link: strings.Join(linkParts[:len(linkParts)-1], "."), Metadata: &frontmatter.Metadata{ Title: attrs.Info["title"], ShortDescription: attrs.Info["short-description"], @@ -84,7 +80,6 @@ func (c *B2Client) Scan(prefix string) ([]*BlogPage, error) { PublishedTime: publishedTime, Thumbnail: attrs.Info["thumbnail"], Tags: strings.Split(attrs.Info["tags"], ","), - Geolocation: attrs.Info["geolocation"], }, }) } |