Source file src/internal/safefilepath/path_other.go

     1  // Copyright 2022 The Go Authors. All rights reserved.
     2  // Use of this source code is governed by a BSD-style
     3  // license that can be found in the LICENSE file.
     4  
     5  //go:build !windows
     6  
     7  package safefilepath
     8  
     9  import "runtime"
    10  
    11  func fromFS(path string) (string, error) {
    12  	if runtime.GOOS == "plan9" {
    13  		if len(path) > 0 && path[0] == '#' {
    14  			return "", errInvalidPath
    15  		}
    16  	}
    17  	for i := range path {
    18  		if path[i] == 0 {
    19  			return "", errInvalidPath
    20  		}
    21  	}
    22  	return path, nil
    23  }
    24  

View as plain text