shithub: hugo

Download patch

ref: b426c20e1494f2c0868673795532b84a0353ced8
parent: 15b66935419089ce465f5d4d6ac159a7aaa76cb4
author: Bjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com>
date: Sat Jul 30 18:32:03 EDT 2016

Return specific error on walk path too short

--- a/helpers/path.go
+++ b/helpers/path.go
@@ -462,6 +462,8 @@
 	return path, nil
 }
 
+var WalkRootTooShortError = errors.New("Path too short. Stop walking.")
+
 // SymbolicWalk is like filepath.Walk, but it supports the root being a
 // symbolic link. It will still not follow symbolic links deeper down in
 // the file structure
@@ -469,7 +471,7 @@
 
 	// Sanity check
 	if len(root) < 4 {
-		return fmt.Errorf("Path to short, cannot walk the root: %s", root)
+		return WalkRootTooShortError
 	}
 
 	// Handle the root first
--