~adnano/kiln-devel

fix: prevent panic when static_dir does not exist v1 APPLIED

oliverpool: 1
 fix: prevent panic when static_dir does not exist

 1 files changed, 7 insertions(+), 0 deletions(-)
Export patchset (mbox)
How do I use this?

Copy & paste the following snippet into your terminal to import this patchset into git:

curl -s https://lists.sr.ht/~adnano/kiln-devel/patches/24636/mbox | git am -3
Learn more about email & git

[PATCH] fix: prevent panic when static_dir does not exist Export this patch

---
This patch prevents a panic when 'static_dir' does not exist.
I choose to simply log it and let the build succeed.
If you prefer, I can change it to abort the build.

Olivier

PS: thank you adnano for your open-source contributions!
 main.go | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/main.go b/main.go
index 39fb70c..b081099 100644
--- a/main.go
+++ b/main.go
@@ -88,6 +88,10 @@ func (s *Site) runTask(task *Task) error {
	if task.StaticDir != "" {
		err := copyAll(task.StaticDir, task.OutputDir)
		if err != nil {
			if os.IsNotExist(err) {
				log.Printf("static_dir '%s' does not exist\n", task.StaticDir)
				return nil
			}
			return err
		}
	}
@@ -96,6 +100,9 @@ func (s *Site) runTask(task *Task) error {

func copyAll(srcDir, dstDir string) error {
	return filepath.Walk(srcDir, func(path string, info fs.FileInfo, err error) error {
		if err != nil {
			return err
		}
		if info.IsDir() {
			// Do nothing
			return nil
-- 
2.33.0
Thanks!

To git@git.sr.ht:~adnano/kiln
   7201859..bff5e89  master -> master