diff --git a/thirdpart/seaserv/service.py b/thirdpart/seaserv/service.py index e6fe3cc444..cfd2f51371 100644 --- a/thirdpart/seaserv/service.py +++ b/thirdpart/seaserv/service.py @@ -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(':')