@@ -773,24 +773,25 @@ func (extraction *Extraction) extractFileInfo(tw *trap.Writer, file string, isDu
773773 var parentLbl trap.Label
774774
775775 for i , component := range components {
776+ var rawPath , canonicalPath string
776777 isRoot := false
777778 if i == 0 {
778- if component == "" {
779- path = "/"
780- isRoot = true
781- } else if regexp .MustCompile (`^[A-Za-z]:$` ).MatchString (component ) {
782- // Handle Windows drive letters by appending "/"
783- path = component + "/"
779+ rawPath = component
780+ if component == "" || regexp .MustCompile (`^[A-Za-z]:$` ).MatchString (component ) {
781+ // Handle linux root and Windows drive letters by appending "/"
782+ canonicalPath = rawPath + "/"
784783 isRoot = true
785784 } else {
786- path = component
785+ canonicalPath = rawPath
787786 }
787+
788788 } else {
789789 path = parentPath + "/" + component
790+ canonicalPath = rawPath
790791 }
791792 if i == len (components )- 1 {
792793 lbl := tw .Labeler .FileLabelFor (file )
793- dbscheme .FilesTable .Emit (tw , lbl , path )
794+ dbscheme .FilesTable .Emit (tw , lbl , canonicalPath )
794795 dbscheme .ContainerParentTable .Emit (tw , parentLbl , lbl )
795796 dbscheme .HasLocationTable .Emit (tw , lbl , emitLocation (tw , lbl , 0 , 0 , 0 , 0 ))
796797 extraction .Lock .Lock ()
@@ -801,14 +802,12 @@ func (extraction *Extraction) extractFileInfo(tw *trap.Writer, file string, isDu
801802 extraction .Lock .Unlock ()
802803 break
803804 }
804- lbl := tw .Labeler .GlobalID (util .EscapeTrapSpecialChars (path ) + ";folder" )
805- dbscheme .FoldersTable .Emit (tw , lbl , path )
805+ lbl := tw .Labeler .GlobalID (util .EscapeTrapSpecialChars (canonicalPath ) + ";folder" )
806+ dbscheme .FoldersTable .Emit (tw , lbl , canonicalPath )
806807 if i > 0 {
807808 dbscheme .ContainerParentTable .Emit (tw , parentLbl , lbl )
808809 }
809- if ! isRoot {
810- parentPath = path
811- }
810+ parentPath = rawPath
812811 parentLbl = lbl
813812 }
814813}
0 commit comments