Skip to content

Commit

Permalink
Make sure we always create the /public folder
Browse files Browse the repository at this point in the history
This is related to gohugoio#8166 – if the /public folder did not exist, you had no /static files and had static files in /content root, then you would get a "no such file or directory" error.
  • Loading branch information
bep committed Dec 23, 2021
1 parent 1c1affe commit eac553d
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions hugolib/filesystems/basefs.go
Original file line number Diff line number Diff line change
Expand Up @@ -428,6 +428,11 @@ func NewBase(p *paths.Paths, logger loggers.Logger, options ...func(*BaseFs) err
logger = loggers.NewWarningLogger()
}

// Make sure we always have the /public folder ready to use.
if err := fs.Destination.Mkdir(p.AbsPublishDir, 0777); err != nil && !os.IsExist(err) {
return nil, err
}

publishFs := hugofs.NewBaseFileDecorator(afero.NewBasePathFs(fs.Destination, p.AbsPublishDir))
sourceFs := hugofs.NewBaseFileDecorator(afero.NewBasePathFs(fs.Source, p.WorkingDir))

Expand Down

0 comments on commit eac553d

Please sign in to comment.