Subject: CleanHelpPath & index.html

From: Andreas 'ads' Scherbaum <[email-masked]>
Date: Wed, 6 Jan 2016 22:47:54 +0100

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
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);

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

---

From: Andreas 'ads' Scherbaum <[email-masked]>
Date: Thu, 7 Jan 2016 06:04:11 +0100

> 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.