File tree Expand file tree Collapse file tree 3 files changed +21
-1
lines changed
Expand file tree Collapse file tree 3 files changed +21
-1
lines changed Original file line number Diff line number Diff line change @@ -34,6 +34,8 @@ Common Changes
3434 string `` is now raised consistently for both Thick and Thin modes.
3535 Previously, Thin mode was raising the error
3636 ``DPY-4030: invalid DRCP pool boundary {boundary} ``.
37+ #) Tightened definition of easy connect string regular expression to avoid
38+ parsing errors with connect descriptors containing the ``/ `` character.
3739
3840
3941oracledb 2.1.1 (March 2024)
Original file line number Diff line number Diff line change @@ -51,7 +51,7 @@ CONTAINER_PARAM_NAMES = set((
5151# regular expression used for determining if a connect string refers to an Easy
5252# Connect string or not
5353EASY_CONNECT_PATTERN = \
54- " ((?P<protocol>\w+)://)?(?P<host>[^:/ ]+)(:(?P<port>\d+)?)?/" \
54+ " ^ ((?P<protocol>\w+)://)?(?P<host>[\w\d.- ]+)(:(?P<port>\d+)?)?/" \
5555 " (?P<service_name>[^:?]*)(:(?P<server_type>\w+))?"
5656
5757# dictionary of tnsnames.ora files, indexed by the directory in which the file
Original file line number Diff line number Diff line change @@ -811,6 +811,24 @@ def test_4570(self):
811811 self .assertEqual (params .supershardingkey , super_sharding_key )
812812 self .assertEqual (params .ssl_context , ssl_context )
813813
814+ def test_4571 (self ):
815+ "4571 - parse connect descriptor with / character in tnsnames.ora"
816+ connect_string = """
817+ (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=my_host)(PORT=4571))
818+ (CONNECT_DATA=(SERVICE_NAME=my_service_name))
819+ (SECURITY=(MY_WALLET_DIRECTORY=/some/dir)))"""
820+ network_service_name = "alias_4571"
821+ with tempfile .TemporaryDirectory () as temp_dir :
822+ file_name = os .path .join (temp_dir , "tnsnames.ora" )
823+ with open (file_name , "w" ) as f :
824+ f .write (f"{ network_service_name } = { connect_string } " )
825+ params = oracledb .ConnectParams (config_dir = temp_dir )
826+ params .parse_connect_string (network_service_name )
827+ self .assertEqual (params .host , "my_host" )
828+ self .assertEqual (params .port , 4571 )
829+ self .assertEqual (params .service_name , "my_service_name" )
830+ self .assertEqual (params .wallet_location , "/some/dir" )
831+
814832
815833if __name__ == "__main__" :
816834 test_env .run_test_cases ()
You can’t perform that action at this time.
0 commit comments