mirror of
https://github.com/fog/fog.git
synced 2022-11-09 13:51:43 -05:00
Bucket names cannot begin with the "goog" prefix. Also change for DNS compliant subdomain
This commit is contained in:
parent
0f12a6069c
commit
19f12a03f2
1 changed files with 13 additions and 2 deletions
|
@ -225,8 +225,19 @@ DATA
|
|||
string_to_sign << "#{canonical_google_headers}"
|
||||
|
||||
subdomain = params[:host].split(".#{@host}").first
|
||||
unless subdomain =~ /^(?:[a-z]|\d(?!\d{0,2}(?:\.\d{1,3}){3}$))(?:[a-z0-9]|\.(?![\.\-])|\-(?![\-])|\_(?![\_])){1,61}[a-z0-9]$/
|
||||
Fog::Logger.warning("fog: the specified google storage bucket name (#{subdomain}) is not a valid dns name. See: https://developers.google.com/storage/docs/bucketnaming")
|
||||
unless subdomain =~ /^(?!goog)(?:[a-z]|\d(?!\d{0,2}(?:\.\d{1,3}){3}$))(?:[a-z0-9]|\.(?![\.\-])|\-(?![\.])){1,61}[a-z0-9]$/
|
||||
if subdomain =~ /_/
|
||||
# https://github.com/fog/fog/pull/1258#issuecomment-10248620.
|
||||
Fog::Logger.warning("fog: the specified google storage bucket name (#{subdomain}) is not DNS compliant (only characters a through z, digits 0 through 9, and the hyphen).")
|
||||
else
|
||||
# - Bucket names must contain only lowercase letters, numbers, dashes (-), underscores (_), and dots (.). Names containing dots require verification.
|
||||
# - Bucket names must start and end with a number or letter.
|
||||
# - Bucket names must contain 3 to 63 characters. Names containing dots can contain up to 222 characters, but each dot-separated component can be no longer than 63 characters.
|
||||
# - Bucket names cannot be represented as an IP address in dotted-decimal notation (for example, 192.168.5.4).
|
||||
# - Bucket names cannot begin with the "goog" prefix.
|
||||
# - Also, for DNS compliance, you should not have a period adjacent to another period or dash. For example, ".." or "-." or ".-" are not acceptable.
|
||||
Fog::Logger.warning("fog: the specified google storage bucket name (#{subdomain}) is not a valid dns name. See: https://developers.google.com/storage/docs/bucketnaming")
|
||||
end
|
||||
params[:host] = params[:host].split("#{subdomain}.")[-1]
|
||||
if params[:path]
|
||||
params[:path] = "#{subdomain}/#{params[:path]}"
|
||||
|
|
Loading…
Add table
Reference in a new issue