mirror of
https://github.com/valitydev/redash.git
synced 2024-11-07 09:28:51 +00:00
Url password can have quoted special characters.
This commit is contained in:
parent
817f2ba9af
commit
c614ff4a15
@ -2,6 +2,7 @@ import os
|
||||
import sys
|
||||
import logging
|
||||
import urlparse
|
||||
import urllib
|
||||
import redis
|
||||
from flask import Flask, safe_join
|
||||
from flask_sslify import SSLify
|
||||
@ -53,8 +54,9 @@ def create_redis_connection():
|
||||
redis_db = redis_url.path[1]
|
||||
else:
|
||||
redis_db = 0
|
||||
|
||||
r = redis.StrictRedis(host=redis_url.hostname, port=redis_url.port, db=redis_db, password=redis_url.password)
|
||||
# Redis passwords might be quoted with special characters
|
||||
redisPassword = urllib.unquote(redis_url.password)
|
||||
r = redis.StrictRedis(host=redis_url.hostname, port=redis_url.port, db=redis_db, password=redisPassword)
|
||||
|
||||
return r
|
||||
|
||||
|
@ -1,6 +1,7 @@
|
||||
import json
|
||||
import os
|
||||
import urlparse
|
||||
import urllib
|
||||
|
||||
|
||||
def parse_db_url(url):
|
||||
@ -14,7 +15,8 @@ def parse_db_url(url):
|
||||
connection['host'] = url_parts.hostname
|
||||
connection['port'] = url_parts.port
|
||||
connection['user'] = url_parts.username
|
||||
connection['password'] = url_parts.password
|
||||
# Passwords might be quoted with special characters
|
||||
connection['password'] = urllib.unquote(url_parts.password)
|
||||
|
||||
return connection
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user