func validatePathAndVersion(ctx context.Context, ds internal.DataSource, fullPath, requestedVersion string) error {
	if !isSupportedVersion(ctx, fullPath, requestedVersion) {
		return &serverError{
			status: http.StatusBadRequest,
			epage: &errorPage{
				messageTemplate: template.MakeTrustedTemplate(`
					<h3 class="Error-message">{{.Version}} is not a valid semantic version.</h3>
					<p class="Error-message">
					  To search for packages like {{.Path}}, <a href="/search?q={{.Path}}">click here</a>.
					</p>`),
				MessageData: struct{ Path, Version string }{fullPath, requestedVersion},
			},
		}
	}
	db, ok := ds.(*postgres.DB)
	if !ok {
		return nil
	}
	excluded, err := db.IsExcluded(ctx, fullPath)
	if err != nil {
		return err
	}
	if excluded {
		// Return NotFound; don't let the user know that the package was excluded.
		return &serverError{status: http.StatusNotFound}
	}
	return nil
}
// validatePathAndVersion verifies that the requested path and version are
// acceptable. The given path may be a module or package path.
validatePathAndVersion verifies that the requested path and version are
acceptable. The given path may be a module or package path.
// validatePathAndVersion verifies that the requested path and version are // acceptable . The given path may be a module or package path .
func validatePathAndVersion(ctx context.Context, ds internal.DataSource, fullPath, requestedVersion string) error {
	if !isSupportedVersion(ctx, fullPath, requestedVersion) {
		return &serverError{
			status: http.StatusBadRequest,
			epage: &errorPage{
				messageTemplate: template.MakeTrustedTemplate(`
					<h3 class="Error-message">{{.Version}} is not a valid semantic version.</h3>
					<p class="Error-message">
					  To search for packages like {{.Path}}, <a href="/search?q={{.Path}}">click here</a>.
					</p>`),
				MessageData: struct{ Path, Version string }{fullPath, requestedVersion},
			},
		}
	}
	db, ok := ds.(*postgres.DB)
	if !ok {
		return nil
	}
	excluded, err := db.IsExcluded(ctx, fullPath)
	if err != nil {
		return err
	}
	if excluded {
		return &serverError{status: http.StatusNotFound}
	}
	return nil
}
func validatePathAndVersion ( ctx context . Context , ds internal . DataSource , fullPath , requestedVersion string ) error { if ! isSupportedVersion ( ctx , fullPath , requestedVersion ) { return & serverError { status : http . StatusBadRequest , epage : & errorPage { messageTemplate : template . MakeTrustedTemplate ( `
					<h3 class="Error-message">{{.Version}} is not a valid semantic version.</h3>
					<p class="Error-message">
					  To search for packages like {{.Path}}, <a href="/search?q={{.Path}}">click here</a>.
					</p>` ) , MessageData : struct { Path , Version string } { fullPath , requestedVersion } , } , } } db , ok := ds . ( * postgres . DB ) if ! ok { return nil } excluded , err := db . IsExcluded ( ctx , fullPath ) if err != nil { return err } if excluded { return & serverError { status : http . StatusNotFound } } return nil }
validatePathAndVersion verifies that the requested path and version are
acceptable.
validatePathAndVersion verifies that the requested path and version are acceptable .
// Return NotFound; don't let the user know that the package was excluded.