Sha256: b22b51cdd6e14b810db1ed0c880d05625617f75ee188c5d73d3943d3df3014fa

Contents?: true

Size: 797 Bytes

Versions: 16

Compression:

Stored size: 797 Bytes

Contents

package gosnowflake

import (
	"net/url"
	"regexp"
)

var (
	matcher, _ = regexp.Compile(`^http(s?)\:\/\/[0-9a-zA-Z]([-.\w]*[0-9a-zA-Z@:])*(:(0-9)*)*(\/?)([a-zA-Z0-9\-\.\?\,\&\(\)\/\\\+&%\$#_=@]*)?$`)
)

func isValidURL(targetURL string) bool {
	if !matcher.MatchString(targetURL) {
		logger.Infof(" The provided URL is not a valid URL - " + targetURL)
		return false
	}
	return true
}

func urlEncode(targetString string) string {
	// We use QueryEscape instead of PathEscape here
	// for consistency across Drivers. For example:
	// QueryEscape escapes space as "+" whereas PE
	// it as %20F. PE also does not escape @ or &
	// either but QE does.
	// The behavior of QE in Golang is more in sync
	// with URL encoders in Python and Java hence the choice
	return url.QueryEscape(targetString)
}

Version data entries

16 entries across 16 versions & 1 rubygems

Version Path
ruby_snowflake_client-1.3.7 ext/vendor/github.com/snowflakedb/gosnowflake/url_util.go
ruby_snowflake_client-1.3.6 ext/vendor/github.com/snowflakedb/gosnowflake/url_util.go
ruby_snowflake_client-1.3.5 ext/vendor/github.com/snowflakedb/gosnowflake/url_util.go
ruby_snowflake_client-1.3.4 ext/vendor/github.com/snowflakedb/gosnowflake/url_util.go
ruby_snowflake_client-1.3.4.pre.debug ext/vendor/github.com/snowflakedb/gosnowflake/url_util.go
ruby_snowflake_client-1.3.3.pre.debug ext/vendor/github.com/snowflakedb/gosnowflake/url_util.go
ruby_snowflake_client-1.3.2 ext/vendor/github.com/snowflakedb/gosnowflake/url_util.go
ruby_snowflake_client-1.3.1 ext/vendor/github.com/snowflakedb/gosnowflake/url_util.go
ruby_snowflake_client-1.3.0 ext/vendor/github.com/snowflakedb/gosnowflake/url_util.go
ruby_snowflake_client-1.2.1 ext/vendor/github.com/snowflakedb/gosnowflake/url_util.go
ruby_snowflake_client-1.2.0 ext/vendor/github.com/snowflakedb/gosnowflake/url_util.go
ruby_snowflake_client-1.1.1 ext/vendor/github.com/snowflakedb/gosnowflake/url_util.go
ruby_snowflake_client-1.1.0 ext/vendor/github.com/snowflakedb/gosnowflake/url_util.go
ruby_snowflake_client-1.0.2 ext/vendor/github.com/snowflakedb/gosnowflake/url_util.go
ruby_snowflake_client-1.0.1 ext/vendor/github.com/snowflakedb/gosnowflake/url_util.go
ruby_snowflake_client-1.0.0 ext/vendor/github.com/snowflakedb/gosnowflake/url_util.go