From a0fc1782ab0368070e7146be7f7ee43b7da928fd Mon Sep 17 00:00:00 2001 From: hikmetba-bit Date: Sun, 20 Sep 2026 09:41:15 +0300 Subject: [PATCH] Decode percent-encoded user/password in connection_url Locker#work parses the connection_url option with URI.parse, then passes uri.user/uri.password straight through to PG::Connection.open. URI#user and URI#password return the RAW percent-encoded component, so a password containing characters that require URL-escaping (e.g. 'p%40ss%3Aword' for 'p@ss:word') was handed to PG::Connection.open still escaped, causing authentication to fail. Decode both with URI.decode_www_form_component before building the connection opts, guarding against nil so a URL with no user/password still works. Fixes #436. --- lib/que/locker.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/que/locker.rb b/lib/que/locker.rb index cb7ec40a..4778bfda 100644 --- a/lib/que/locker.rb +++ b/lib/que/locker.rb @@ -149,8 +149,8 @@ def initialize( opts = { host: uri.host, - user: uri.user, - password: uri.password, + user: uri.user && URI.decode_www_form_component(uri.user), + password: uri.password && URI.decode_www_form_component(uri.password), port: uri.port || 5432, dbname: uri.path[1..-1], }