mirror of
https://github.com/gohugoio/hugo.git
synced 2025-08-20 21:31:32 +02:00
@@ -17,7 +17,6 @@ package commands
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"net/http"
|
||||
"os"
|
||||
"path/filepath"
|
||||
@@ -971,19 +970,7 @@ func isThemeVsHugoVersionMismatch() (mismatch bool, requiredMinVersion string) {
|
||||
return
|
||||
}
|
||||
|
||||
f, err := fs.Open(path)
|
||||
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
defer f.Close()
|
||||
|
||||
b, err := ioutil.ReadAll(f)
|
||||
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
b, err := afero.ReadFile(fs, path)
|
||||
|
||||
c, err := parser.HandleTOMLMetaData(b)
|
||||
|
||||
|
@@ -20,6 +20,7 @@ import (
|
||||
"time"
|
||||
|
||||
"github.com/spf13/cobra"
|
||||
"github.com/spf13/hugo/hugofs"
|
||||
"github.com/spf13/hugo/parser"
|
||||
)
|
||||
|
||||
@@ -46,7 +47,7 @@ func Undraft(cmd *cobra.Command, args []string) error {
|
||||
|
||||
location := args[0]
|
||||
// open the file
|
||||
f, err := os.Open(location)
|
||||
f, err := hugofs.Source().Open(location)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
@@ -63,7 +64,7 @@ func Undraft(cmd *cobra.Command, args []string) error {
|
||||
return newSystemErrorF("an error occurred while undrafting %q: %s", location, err)
|
||||
}
|
||||
|
||||
f, err = os.OpenFile(location, os.O_WRONLY|os.O_TRUNC, 0644)
|
||||
f, err = hugofs.Source().OpenFile(location, os.O_WRONLY|os.O_TRUNC, 0644)
|
||||
if err != nil {
|
||||
return newSystemErrorF("%q not be undrafted due to error opening file to save changes: %q\n", location, err)
|
||||
}
|
||||
|
Reference in New Issue
Block a user