Fix serving . but absolute and parents still cause bugs
parent
0595c49fc2
commit
618b9ed513
|
|
@ -18,8 +18,10 @@ type Path struct {
|
||||||
func NewPathFromLocal(p string) Path {
|
func NewPathFromLocal(p string) Path {
|
||||||
splits := strings.SplitN(p, path.Base(config.Root), 2)
|
splits := strings.SplitN(p, path.Base(config.Root), 2)
|
||||||
href := splits[0]
|
href := splits[0]
|
||||||
if len(splits) > 1 {
|
if len(splits) > 1 && splits[0] == "" {
|
||||||
href = splits[1]
|
href = splits[1]
|
||||||
|
} else {
|
||||||
|
href = strings.Join(splits, path.Base(config.Root))
|
||||||
}
|
}
|
||||||
href = path.Join("/notes", href)
|
href = path.Join("/notes", href)
|
||||||
return NewPathFromURL(href)
|
return NewPathFromURL(href)
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue