return true
}
-func IsValidPathPath(path string) (bool, string) {
+func IsValidPath(path string) (bool, string) {
path = canonicalizePath(path)
_, err := os.Lstat(path)
return err == nil && checkInJail(path), path
}
for _, info := range fileinfos {
- name := info.Name
- if info.IsDirectory() {
+ name := info.Name()
+ if info.IsDir() {
name += "/"
}
if !gConfig.IncludeDotfiles && name[0] == '.' {
okResponse(response, data)
}
case "tv_rename":
- newPath, err := tv_rename.RenameEpisode(request.FormValue("path"))
+ newPath, err := RenameTVEpisode(request.FormValue("path"))
if err != nil {
errorResponse(response, err.Error())
} else {
mux.HandleFunc("/download", downloadHandler)
mux.HandleFunc("/proxy", proxyHandler)
- error := http.ListenAndServe(fmt.Sprintf(":%d", config.Port), mux)
+ error := http.ListenAndServe(fmt.Sprintf(":%d", gConfig.Port), mux)
fmt.Printf("error %v", error)
}
// Takes a full file path and renames the last path component as if it were a
// TV episode. This performs the actual rename as well.
-func RenameEpisode(inPath string) (*string, error) {
+func RenameTVEpisode(inPath string) (*string, error) {
// Parse the filename into its components.
dirName, fileName := path.Split(inPath)
info := parseEpisodeName(fileName)