mirror of
				https://github.com/gohugoio/hugo.git
				synced 2024-05-11 05:54:58 +00:00 
			
		
		
		
	Also consider wrapped errors when checking for file IsNotExist errors
Fixes #10534
This commit is contained in:
		@@ -29,6 +29,7 @@ import (
 | 
			
		||||
	"time"
 | 
			
		||||
 | 
			
		||||
	"github.com/gohugoio/hugo/common/collections"
 | 
			
		||||
	"github.com/gohugoio/hugo/common/herrors"
 | 
			
		||||
	"github.com/gohugoio/hugo/common/hexec"
 | 
			
		||||
 | 
			
		||||
	hglob "github.com/gohugoio/hugo/hugofs/glob"
 | 
			
		||||
@@ -193,7 +194,8 @@ func (c *Client) Tidy() error {
 | 
			
		||||
//
 | 
			
		||||
// We, by default, use the /_vendor folder first, if found. To disable,
 | 
			
		||||
// run with
 | 
			
		||||
//    hugo --ignoreVendorPaths=".*"
 | 
			
		||||
//
 | 
			
		||||
//	hugo --ignoreVendorPaths=".*"
 | 
			
		||||
//
 | 
			
		||||
// Given a module tree, Hugo will pick the first module for a given path,
 | 
			
		||||
// meaning that if the top-level module is vendored, that will be the full
 | 
			
		||||
@@ -297,7 +299,7 @@ func (c *Client) Vendor() error {
 | 
			
		||||
		configFiles = append(configFiles, filepath.Join(dir, "theme.toml"))
 | 
			
		||||
		for _, configFile := range configFiles {
 | 
			
		||||
			if err := hugio.CopyFile(c.fs, configFile, filepath.Join(vendorDir, t.Path(), filepath.Base(configFile))); err != nil {
 | 
			
		||||
				if !os.IsNotExist(err) {
 | 
			
		||||
				if !herrors.IsNotExist(err) {
 | 
			
		||||
					return err
 | 
			
		||||
				}
 | 
			
		||||
			}
 | 
			
		||||
@@ -560,7 +562,7 @@ func (c *Client) rewriteGoModRewrite(name string, isGoMod map[string]bool) ([]by
 | 
			
		||||
	b := &bytes.Buffer{}
 | 
			
		||||
	f, err := c.fs.Open(filepath.Join(c.ccfg.WorkingDir, name))
 | 
			
		||||
	if err != nil {
 | 
			
		||||
		if os.IsNotExist(err) {
 | 
			
		||||
		if herrors.IsNotExist(err) {
 | 
			
		||||
			// It's been deleted.
 | 
			
		||||
			return nil, nil
 | 
			
		||||
		}
 | 
			
		||||
 
 | 
			
		||||
@@ -23,6 +23,7 @@ import (
 | 
			
		||||
	"time"
 | 
			
		||||
 | 
			
		||||
	"github.com/bep/debounce"
 | 
			
		||||
	"github.com/gohugoio/hugo/common/herrors"
 | 
			
		||||
	"github.com/gohugoio/hugo/common/loggers"
 | 
			
		||||
 | 
			
		||||
	"github.com/spf13/cast"
 | 
			
		||||
@@ -539,7 +540,7 @@ func (c *collector) collectModulesTXT(owner Module) error {
 | 
			
		||||
 | 
			
		||||
	f, err := c.fs.Open(filename)
 | 
			
		||||
	if err != nil {
 | 
			
		||||
		if os.IsNotExist(err) {
 | 
			
		||||
		if herrors.IsNotExist(err) {
 | 
			
		||||
			return nil
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user