Don't canonicalize paths in tv_rename, which allows us to remove paths.Verify()
authorRobert Sesek <rsesek@bluestatic.org>
Sat, 16 Apr 2011 22:09:32 +0000 (18:09 -0400)
committerRobert Sesek <rsesek@bluestatic.org>
Sat, 16 Apr 2011 22:09:32 +0000 (18:09 -0400)
src/paths.go
src/tv_rename.go

index 27b92c10d30f6021ef6539e2a5f8bd4a71717cc8..428c9b2e179400c42f3dfcc854ec132a5e1bc6b2 100644 (file)
@@ -41,16 +41,6 @@ func checkInJail(the_path string) bool {
   return true
 }
 
-// Verifies that the path is in the jail and returns the cleaned-up path. Will
-// return nil on error.
-func Verify(thePath string) *string {
-  fullPath := canonicalizePath(thePath)
-  if !checkInJail(fullPath) {
-    return nil
-  }
-  return &fullPath
-}
-
 func List(the_path string) (files vector.StringVector, err os.Error) {
   full_path := canonicalizePath(the_path)
   if !checkInJail(full_path) {
index f07fc0494862b3615b735f30758e51ed4a0bd0c8..b331f7aed9e234e301b4ca39a29c93223bcd1bf6 100644 (file)
@@ -19,29 +19,13 @@ import (
   "regexp"
   "strconv"
   "strings"
-  "./paths"
 )
 
 // 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, os.Error) {
-  // Make sure a path was given.
-  if len(inPath) < 1 {
-    return nil, os.NewError("Invalid path")
-  }
-  // Check that it's inside the jail.
-  var safePath *string = paths.Verify(inPath)
-  if safePath == nil {
-    return nil, os.NewError("Path is invalid or outside of jail")
-  }
-  // Make sure that the file exists.
-  _, err := os.Stat(*safePath)
-  if err != nil {
-    return nil, err
-  }
-
   // Parse the filename into its components.
-  dirName, fileName := path.Split(*safePath)
+  dirName, fileName := path.Split(inPath)
   info := parseEpisodeName(fileName)
   if info == nil {
     return nil, os.NewError("Could not parse file name")