Skip to content

Commit 2d7129b

Browse files
Validate underscores in host names successfully
For eg, `minio_server` should be treated as valid hostname. Fixes #760
1 parent 3efe9e9 commit 2d7129b

File tree

3 files changed

+5
-2
lines changed

3 files changed

+5
-2
lines changed

appveyor.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ environment:
77

88
install:
99
# We need wheel installed to build wheels
10-
- "%PYTHON%\\python.exe -m pip install wheel faker nose"
10+
- "%PYTHON%\\python.exe -m pip install wheel faker nose mock"
1111
- "%PYTHON%\\python.exe setup.py install"
1212

1313
build: off

minio/helpers.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@
5353

5454
_VALID_BUCKETNAME_REGEX = re.compile('^[a-z0-9][a-z0-9\\.\\-]+[a-z0-9]$')
5555
_ALLOWED_HOSTNAME_REGEX = re.compile(
56-
'^((?!-)[A-Z\\d-]{1,63}(?<!-)\\.)*((?!-)[A-Z\\d-]{1,63}(?<!-))$',
56+
'^((?!-)(?!_)[A-Z\_\\d-]{1,63}(?<!-)(?<!_)\\.)*((?!_)(?!-)[A-Z\_\\d-]{1,63}(?<!-)(?<!_))$',
5757
re.IGNORECASE)
5858

5959
_EXTRACT_REGION_REGEX = re.compile('s3[.-]?(.+?).amazonaws.com')

tests/unit/get_s3_endpoint_test.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,3 +27,6 @@ def test_get_s3_endpoint(self):
2727
def test_is_valid_endpoint(self):
2828
eq_(True, is_valid_endpoint('s3.amazonaws.com'))
2929
eq_(True, is_valid_endpoint('s3.cn-north-1.amazonaws.com.cn'))
30+
eq_(True, is_valid_endpoint('minio_server:9000'))
31+
eq_(True, is_valid_endpoint('s3.server_1.amazonaws.com'))
32+

0 commit comments

Comments
 (0)