public inbox for [email protected]  
help / color / mirror / Atom feed
CleanHelpPath & index.html
2+ messages / 1 participants
[nested] [flat]

* CleanHelpPath & index.html
@ 2016-01-06 21:47  Andreas 'ads' Scherbaum <[email protected]>
  0 siblings, 1 reply; 2+ messages in thread

From: Andreas 'ads' Scherbaum @ 2016-01-06 21:47 UTC (permalink / raw)
  To: pgadmin-hackers


Hi,

looking into misc.cpp, around line 661, there is CleanHelpPath. When I 
try to add a documentation link ending with "index.html", this function 
incorrectly assumes that it must be a directory and adds a "/" (or 
whatever the current separator is).

This even happens when the correct link is in ~/.pgadmin3. The link is 
then read from the config file, cleaned up incorrectly and when I try to 
open the help link, it points to the wrong URL (index.html/).

Attached is a small patch which checks a string in CleanHelpPath if it 
ends in one of the most common file types (.htm, .html, .php and .asp) 
and if this is the case, the string is returned as is.


Regards,

-- 
				Andreas 'ads' Scherbaum
German PostgreSQL User Group
European PostgreSQL User Group - Board of Directors
Volunteer Regional Contact, Germany - PostgreSQL Project


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


Attachments:

  [text/x-patch] misc.diff (1.7K, 2-misc.diff)
  download | inline diff:
diff --git a/pgadmin/utils/misc.cpp b/pgadmin/utils/misc.cpp
index 93b56f8..35062c4 100644
--- a/pgadmin/utils/misc.cpp
+++ b/pgadmin/utils/misc.cpp
@@ -676,7 +676,14 @@ wxString CleanHelpPath(const wxString &path)
 	        thePath.Lower().EndsWith(wxT(".zip")))
 		return thePath;
 
-	// In all othe cases we must have a directory
+	// Not everything is a directory
+	if (thePath.Lower().EndsWith(wxT(".htm")) ||
+	        thePath.Lower().EndsWith(wxT(".html")) ||
+	        thePath.Lower().EndsWith(wxT(".php")) ||
+	        thePath.Lower().EndsWith(wxT(".asp")))
+		return thePath;
+
+	// In all other cases we must have a directory
 	wxString sep;
 
 	// Figure out the appropriate seperator
@@ -763,10 +770,20 @@ void DisplayHelp(const wxString &helpTopic, const HelpType helpType)
 		{
 			// the old help path (stored in the settings) is no longer working
 			static wxString gpHelpPath = settings->GetGpHelpPath();
+			wxPrintf(wxT("misc.cpp: %s\n"), gpHelpPath.c_str());
 
+			if (gpHelpPath.CmpNoCase(wxT("http://docs.gopivotal.com/gpdb/")) == 0)
+			{
+				gpHelpPath = wxT("http://gpdb.docs.pivotal.io/index.html");
+				// Replace the path to the old domain with the link to
+				// the new documentation path
+				// The old link is working for now, but there is no guarantee
+				// that it will stay this way
+				settings->SetGpHelpPath(gpHelpPath);
+			}
 			if (gpHelpPath.CmpNoCase(wxT("http://www.greenplum.com/docs/3300/")) == 0)
 			{
-				gpHelpPath = wxT("http://docs.gopivotal.com/gpdb/");
+				gpHelpPath = wxT("http://gpdb.docs.pivotal.io/index.html");
 				// this is the old link, update the link to the new documentation link
 				// problem: this saves the link into the configuration file
 				settings->SetGpHelpPath(gpHelpPath);


^ permalink  raw  reply  [nested|flat] 2+ messages in thread

* Re: CleanHelpPath & index.html
@ 2016-01-07 05:04  Andreas 'ads' Scherbaum <[email protected]>
  parent: Andreas 'ads' Scherbaum <[email protected]>
  0 siblings, 0 replies; 2+ messages in thread

From: Andreas 'ads' Scherbaum @ 2016-01-07 05:04 UTC (permalink / raw)
  To: pgadmin-hackers

On 06.01.2016 22:47, Andreas 'ads' Scherbaum wrote:
>
> looking into misc.cpp, around line 661, there is CleanHelpPath. When I
> try to add a documentation link ending with "index.html", this function
> incorrectly assumes that it must be a directory and adds a "/" (or
> whatever the current separator is).
>
> This even happens when the correct link is in ~/.pgadmin3. The link is
> then read from the config file, cleaned up incorrectly and when I try to
> open the help link, it points to the wrong URL (index.html/).
>
> Attached is a small patch which checks a string in CleanHelpPath if it
> ends in one of the most common file types (.htm, .html, .php and .asp)
> and if this is the case, the string is returned as is.

Actually, screw this patch. pgAdmin3::InitHelp() does some very obscure 
magic if a path ends on "index.html", but only for ".html", not for 
other endings.

I don't know why the old Greenplum documentation link worked before - it 
ends in "index.html". It definitely does not work anymore, but that is 
another patch.

-- 
				Andreas 'ads' Scherbaum
German PostgreSQL User Group
European PostgreSQL User Group - Board of Directors
Volunteer Regional Contact, Germany - PostgreSQL Project


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




^ permalink  raw  reply  [nested|flat] 2+ messages in thread


end of thread, other threads:[~2016-01-07 05:04 UTC | newest]

Thread overview: 2+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2016-01-06 21:47 CleanHelpPath & index.html Andreas 'ads' Scherbaum <[email protected]>
2016-01-07 05:04 ` Andreas 'ads' Scherbaum <[email protected]>

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