aboutsummaryrefslogblamecommitdiff
path: root/http_template_funcs.go
blob: 9609e61971efb9bf65ba39fc943f4f745f9660f0 (plain) (tree)
1
2
3
4
5
6
7
8
9
10


                                                       

            
        
                 
              

                 
 
                                 


                                            
 
                                
                           
 
 
                                  


                                
                                   

                                 
// SPDX-License-Identifier: AGPL-3.0-only
// SPDX-FileContributor: Runxi Yu <https://runxiyu.org>

package main

import (
	"net/url"
	"path"
	"strings"
)

func firstLine(s string) string {
	before, _, _ := strings.Cut(s, "\n")
	return before
}

func baseName(s string) string {
	return path.Base(s)
}

func pathEscape(s string) string {
	return url.PathEscape(s)
}

func queryEscape(s string) string {
	return url.QueryEscape(s)
}