URI: 
       helpers: Use net/url for URL parsing in AbsURL - hugo - [fork] hugo port for 9front
  HTML git clone git@git.drkhsh.at/hugo.git
   DIR Log
   DIR Files
   DIR Refs
   DIR Submodules
   DIR README
   DIR LICENSE
       ---
   DIR commit e4ee1b89ad21f46dab96c9099f554bef4602650b
   DIR parent 16b71bbbb4c283f29e6e757dbf1fc304703704a9
  HTML Author: Cameron Moore <moorereason@gmail.com>
       Date:   Wed, 27 Apr 2016 09:54:44 -0500
       
       helpers: Use net/url for URL parsing in AbsURL
       
       Fixes #2112
       
       Diffstat:
         M helpers/url.go                      |       7 ++++++-
         M helpers/url_test.go                 |       2 ++
       
       2 files changed, 8 insertions(+), 1 deletion(-)
       ---
   DIR diff --git a/helpers/url.go b/helpers/url.go
       @@ -148,7 +148,12 @@ func MakePermalink(host, plink string) *url.URL {
        
        // AbsURL creates a absolute URL from the relative path given and the BaseURL set in config.
        func AbsURL(path string) string {
       -        if strings.HasPrefix(path, "http") || strings.HasPrefix(path, "//") {
       +        url, err := url.Parse(path)
       +        if err != nil {
       +                return path
       +        }
       +
       +        if url.IsAbs() || strings.HasPrefix(path, "//") {
                        return path
                }
        
   DIR diff --git a/helpers/url_test.go b/helpers/url_test.go
       @@ -52,9 +52,11 @@ func TestAbsURL(t *testing.T) {
                        {"", "http://base/ace/", "http://base/ace/"},
                        {"/test/2/foo/", "http://base", "http://base/test/2/foo/"},
                        {"http://abs", "http://base/", "http://abs"},
       +                {"schema://abs", "http://base/", "schema://abs"},
                        {"//schemaless", "http://base/", "//schemaless"},
                        {"test/2/foo/", "http://base/path", "http://base/path/test/2/foo/"},
                        {"/test/2/foo/", "http://base/path", "http://base/test/2/foo/"},
       +                {"http//foo", "http://base/path", "http://base/path/http/foo"},
                }
        
                for _, test := range tests {