* Check Installed Plugins Against The Store Downloads

For users to report plugin bugs and request plugin enhancements; and for authors to test new/new versions of plugins, and to discuss plugin development (in the Programming Technicalities sub-forum). If you want advice on choosing or using a plugin, please ask in General Usage or an appropriate sub-forum.
Post Reply
User avatar
tatewise
Megastar
Posts: 27087
Joined: 25 May 2010 11:00
Family Historian: V7
Location: Torbay, Devon, UK
Contact:

Check Installed Plugins Against The Store Downloads

Post by tatewise » 03 Mar 2014 23:29

A user of one of my Plugins has just reported a problem, which on investigation appears to arise in the Check Installed Plugins Against The Store Plugin.

When an updated Plugin is detected and downloaded, every line has the Carriage Return character code 13 appended.

I have repeated this several times with different Plugins:
Both Ancestral Sources Data Entry and Change Any Fact Tag
But if they are downloaded directly from the FH Plugin Store there is no problem.

If Check Installed Plugins Against The Store line 124 has the following line inserted after it, the problem is fixed.

Code: Select all

        data = data:gsub(string.char(13),"")  -- Remove CR characters
Mike Tate ~ researching the Tate and Scott family history ~ tatewise ancestry

User avatar
tatewise
Megastar
Posts: 27087
Joined: 25 May 2010 11:00
Family Historian: V7
Location: Torbay, Devon, UK
Contact:

Re: Check Installed Plugins Against The Store Downloads

Post by tatewise » 04 Mar 2014 09:26

Thank you Jane for updating the Plugin so quickly, but overnight I have realised that the change would remove any genuine CR, such as in my encoder library used for HTML XHTML XML URI UTF8 ISO CP1252 character encodings.
Thus the following line would be better and clearer:

Code: Select all

        data = data:gsub("\r\n","\n")  -- Remove CR characters at end of line
Sorry!
Mike Tate ~ researching the Tate and Scott family history ~ tatewise ancestry

User avatar
Jane
Site Admin
Posts: 8442
Joined: 01 Nov 2002 15:00
Family Historian: V7
Location: Somerset, England
Contact:

Re: Check Installed Plugins Against The Store Downloads

Post by Jane » 04 Mar 2014 10:04

I have got Calico to release the newer one, can you double check it with any you are worried about.

Thanks
Jane
My Family History : My Photography "Knowledge is knowing that a tomato is a fruit. Wisdom is not putting it in a fruit salad."

User avatar
tatewise
Megastar
Posts: 27087
Joined: 25 May 2010 11:00
Family Historian: V7
Location: Torbay, Devon, UK
Contact:

Re: Check Installed Plugins Against The Store Downloads

Post by tatewise » 04 Mar 2014 14:04

I have checked the original Plugin, the interim Plugin, and the latest Plugin.

The original Plugin consistently uses Carr.Ret. (code 13) and New Line (code 10) characters at the end of every line.
I have searched the WinHttpRequest online documentation for Properties such as ResponseBody and ResponseText and Option but nothing explains or adjusts that feature, except that CRLF is a common line delimiter.

Both the interim Plugin, and the latest Plugin behave perfectly correctly, and in fact neither upset the code I was concerned about. But I still think the latest version is a cleaner solution.
In hindsight I realise that in Plugins there never are any Carr.Ret. (code 13) characters, only pairs of ANSI characters \ & r - doh!

Do you recall the Plugin Discussion last October about Possible enhancement for Search and Replace (6069) in which extra CR at end of lines was a mysterious problem?
Well, I think the cause has now been discovered and fixed :)

As we discovered then, downloading directly from the Plugin Store does not suffer the problem.
It is only the WinHttpRequest ResponseBody that inserts the CR.

I have added a note to plugins:code_snippets:read_direct_from_web_page|> Read Direct From Web Page (code snippet).
Mike Tate ~ researching the Tate and Scott family history ~ tatewise ancestry

Post Reply