Bug and bugfix: Local feeds in UNIX environments

View: New views
3 Messages — Rating Filter:   Alert me  

Bug and bugfix: Local feeds in UNIX environments

by Steve Wolter :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Dear NewsFox developers,

first of all, sorry for not filing this bug in BugZilla.

When adding a local feed to your fine program, I've run into problems.
After grepping the source code, I've discovered several instances of
code like

"file:///" + file.path

in your code. You might be aware that such code is highly unportable;
it might work on forest file systems like Windows' one, but evryone
else today uses tree file systems, which already start filenames with
a '/'. Thus, the above expression evaluates to "file:////vol/foo", for
example, which is one slash too much.

A bugfix might include simply checking for a leading / in the file
and adding it only if necessary.

If you have further questions about the difference between the first
two // in the file:/// and the third, feel free to contact me.

Faithfully yours, Steve Wolter

--
Your mode of life will be changed for the better because of new developments.


_______________________________________________
Newsfox mailing list
Newsfox@...
http://mozdev.org/mailman/listinfo/newsfox

signature.asc (196 bytes) Download Attachment

Re: Bug and bugfix: Local feeds in UNIX environments

by Steve Wolter :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Steve Wolter wrote:

Hello again,

> "file:///" + file.path

Excuse my earlier mail - the mistake seemed to be in a different place.
The uid generating function in the model.js file seems broken; for a
URL like file:///, it generates an empty uid.

I've fixed it. A diff is attached.

Faithfully yours, Steve

--
Almost anything derogatory you could say about today's software design
would be accurate.
                -- K. E. Iverson

87c87
<   {
---
> {
89,93d88
< var body;
< if( index > -1 )
< body = url.substring(index+3);
< else
< body = url;
95,98c90,104
< if( body.indexOf("/") != -1 )
< domain = body.split("/")[0];
< if( domain.indexOf(":") != -1 )
< domain = domain.split(":")[0]; // there are cases when port number follows domain name
---

>     if (url.substring(0, index) != "file") {
>       var body;
>       if( index > -1 )
> body = url.substring(index+3);
>       else
> body = url;
>       if( body.indexOf("/") != -1 )
> domain = body.split("/")[0];
>       if( domain.indexOf(":") != -1 )
> domain = domain.split(":")[0]; // there are cases when port number follows domain name
>     } else {
>       // There actually _has_ to be a "/" in there - because there is a "//"
>       var filenamestart = url.lastIndexOf("/")+1;
>       domain = url.substring(filenamestart);
>     }


_______________________________________________
Newsfox mailing list
Newsfox@...
http://mozdev.org/mailman/listinfo/newsfox

signature.asc (196 bytes) Download Attachment

Re: Bug and bugfix: Local feeds in UNIX environments

by R Pruitt :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Steve Wolter wrote:
Steve Wolter wrote:

Hello again,

> "file:///" + file.path

Excuse my earlier mail - the mistake seemed to be in a different place.
Yes, 'file.path' is a relative path ('usr/bin' or 'G:\Desktop' for example) so the code works on any system.  There is a RIGHT way to do it, but it makes for harder to read, slower code.  Might change it someday....

Steve Wolter wrote:
The uid generating function in the model.js file seems broken; for a
URL like file:///, it generates an empty uid.

I've fixed it. A diff is attached.

Faithfully yours, Steve

*CODE REMOVED*
This will be fixed in the next version of Newsfox:

> if (url.charAt(index+3) == "/")  //  file:///
>  body = url.substring(index+4);

Does anyone use these?  I finally changed it since I wanted to check out a feed locally before putting it on a server.  Local feeds are a royal pain in Firefox since their cache handling for local files is a disaster.  To get the feed to update properly, you may need to delete all articles.

Ron