public inbox for [email protected]  
help / color / mirror / Atom feed
From: Surinder Kumar <[email protected]>
To: pgadmin-hackers <[email protected]>
Subject: [pgAdmin4][Patch]: SYNONYM issue if use all special characters as name
Date: Fri, 14 Oct 2016 19:48:06 +0530
Message-ID: <CAM5-9D-zLCt6bBz1UvNpbd9R3ajNrxZNmxH=5j2QwZs0J1fQQg@mail.gmail.com> (raw)
List-Unsubscribe:  <mailto:[email protected]?body=unsub%20pgadmin-hackers>

Hi

*Issue:*
If synonym name contains special characters, the request url is be '404 not
found'.
i.e. It doesn't hit at 'sql' method of synonym.

*Solution:*
If URL has an identifier containing slash character '/' into the URI, then
set param type to path.
like /<path: int>.
Because if param name contains '/' in synonym name, it gets confused and
wrong route is formed.
Reference:- http://flask.pocoo.org/snippets/76/

Please find attached patch and review.

Thanks,
Surinder Kumar


-- 
Sent via pgadmin-hackers mailing list ([email protected])
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgadmin-hackers


Attachments:

  [application/octet-stream] RM1622.patch (923B, 3-RM1622.patch)
  download | inline diff:
diff --git a/web/pgadmin/browser/server_groups/servers/databases/schemas/synonyms/__init__.py b/web/pgadmin/browser/server_groups/servers/databases/schemas/synonyms/__init__.py
index 087e26e..2d36d27 100644
--- a/web/pgadmin/browser/server_groups/servers/databases/schemas/synonyms/__init__.py
+++ b/web/pgadmin/browser/server_groups/servers/databases/schemas/synonyms/__init__.py
@@ -149,8 +149,13 @@ class SynonymView(PGChildNodeView):
         {'type': 'int', 'id': 'did'},
         {'type': 'int', 'id': 'scid'}
     ]
+    # If URL has an identifier containing slash character '/'
+    # into the URI, then set param type to path. Because if
+    # param name contains '/' in syid, it gets confused and
+    # wrong url is generated.
+    # Reference:- http://flask.pocoo.org/snippets/76/
     ids = [
-        {'type': 'string', 'id': 'syid'}
+        {'type': 'path', 'id': 'syid'}
     ]
 
     operations = dict({


view thread (2+ messages)  latest in thread

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: [email protected]
  Cc: [email protected]
  Subject: Re: [pgAdmin4][Patch]: SYNONYM issue if use all special characters as name
  In-Reply-To: <CAM5-9D-zLCt6bBz1UvNpbd9R3ajNrxZNmxH=5j2QwZs0J1fQQg@mail.gmail.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox