1
0
mirror of https://github.com/haiwen/seahub.git synced 2025-05-10 17:05:06 +00:00

fixed a bug when parsing SERVICE_URL

This commit is contained in:
lins05 2013-01-17 10:46:18 +08:00
parent 1bf0a0fe22
commit 87db2ca986

View File

@ -40,6 +40,7 @@ import ConfigParser
import ccnet
import seafile
import re
from pysearpc import SearpcError
ENVIRONMENT_VARIABLES = ('CCNET_CONF_DIR', 'SEAFILE_CONF_DIR')
@ -75,7 +76,12 @@ config.read(os.path.join(CCNET_CONF_PATH, 'ccnet.conf'))
if config.has_option('General', 'SERVICE_URL') and \
config.has_option('Network', 'PORT'):
service_url = config.get('General', 'SERVICE_URL')
service_url = service_url.lstrip('http://').lstrip('https://')
if service_url.startswith('http://'):
service_url = service_url[7:]
elif service_url.startswith('https://'):
service_url = service_url[8:]
if ':' in service_url:
# strip http port such as ':8000' in 'http://192.168.1.101:8000'
idx = service_url.index(':')