Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 4 of 4 for urlToFilePath (0.38 sec)

  1. src/cmd/go/internal/web/url_test.go

    			}
    
    			path, err := urlToFilePath(u)
    			if err != nil {
    				if err.Error() == tc.wantErr {
    					return
    				}
    				if tc.wantErr == "" {
    					t.Fatalf("urlToFilePath(%v): %v; want <nil>", u, err)
    				} else {
    					t.Fatalf("urlToFilePath(%v): %v; want %s", u, err, tc.wantErr)
    				}
    			}
    
    			if path != tc.filePath || tc.wantErr != "" {
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Mon Jun 10 13:43:51 UTC 2019
    - 1.7K bytes
    - Viewed (0)
  2. src/cmd/go/internal/web/url.go

    	"net/url"
    	"path/filepath"
    	"strings"
    )
    
    // TODO(golang.org/issue/32456): If accepted, move these functions into the
    // net/url package.
    
    var errNotAbsolute = errors.New("path is not absolute")
    
    func urlToFilePath(u *url.URL) (string, error) {
    	if u.Scheme != "file" {
    		return "", errors.New("non-file URL")
    	}
    
    	checkAbs := func(path string) (string, error) {
    		if !filepath.IsAbs(path) {
    			return "", errNotAbsolute
    		}
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Mon Jun 10 13:43:51 UTC 2019
    - 2K bytes
    - Viewed (0)
  3. src/cmd/go/internal/web/api.go

    	}
    
    	if eErr := e.Err; eErr != nil {
    		if pErr, ok := e.Err.(*fs.PathError); ok {
    			if u, err := url.Parse(e.URL); err == nil {
    				if fp, err := urlToFilePath(u); err == nil && pErr.Path == fp {
    					// Remove the redundant copy of the path.
    					eErr = pErr.Err
    				}
    			}
    		}
    		return fmt.Sprintf("reading %s: %v", e.URL, eErr)
    	}
    
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Tue Oct 25 13:00:34 UTC 2022
    - 6.9K bytes
    - Viewed (0)
  4. src/cmd/go/internal/web/http.go

    				r.errorDetail.r = res.Body
    				r.Body = &r.errorDetail
    			}
    		}
    	}
    
    	return r, nil
    }
    
    func getFile(u *urlpkg.URL) (*Response, error) {
    	path, err := urlToFilePath(u)
    	if err != nil {
    		return nil, err
    	}
    	f, err := os.Open(path)
    
    	if os.IsNotExist(err) {
    		return &Response{
    			URL:        u.Redacted(),
    			Status:     http.StatusText(http.StatusNotFound),
    Registered: Wed Jun 12 16:32:35 UTC 2024
    - Last Modified: Thu Aug 10 17:34:27 UTC 2023
    - 9.7K bytes
    - Viewed (0)
Back to top