rejetto forum

Software => HFS ~ HTTP File Server => Bug reports => Topic started by: mchurch13 on September 10, 2015, 12:24:50 AM

Title: 404 Not Found Server Error
Post by: mchurch13 on September 10, 2015, 12:24:50 AM
I did not notice this problem myself but was notified by a friend I share files with.  I am running HFS under windows.  The problem is active in Win7/8.1/10.  HFS version is 2.3f (build 294).

There are 2 problems actually.  I have tried the default and various other custom templates.  Some have these issues, some do not.

The first problem is with file sorting, either by clicking a column heading or alternate method depending on the template used.  Sorting in the root directory seems fine but as soon as I move down into any other directory, trying to sort ends up in a 404 not found server error.

The second problem is downloading files into a HFS created archive.  Once again, this works fine in the root directory but in any other directory it results in a 404 not found server error.

Both of these issues are found active in the default template.  Some of the custom templates I have tried have either one or the other or both.  The issues are not active in HFS 2.3 beta (build 287). 

<edit>  I found version 2.3e SSL 293i.  Neither of these issues are apparent in this version either.  Which is the version I will use (since I also like the choice of the built in templates).  The Black & Gold is great !
Title: Re: 404 Not Found Server Error
Post by: rejetto on September 10, 2015, 02:08:37 PM
first problem: doesn't happen here. I think you have a bad template running. What's the URL in your browser when you get the 404 error ?

second: i expect it to be the same problem, actually.
Title: Re: 404 Not Found Server Error
Post by: mchurch13 on September 11, 2015, 02:16:26 AM
If it is a template problem, it is also in the default built in template....

Screen shot 1 is when I try to sort by clicking a column heading.
Screen shot 2 is when I try to download files in an archive.
Title: Re: 404 Not Found Server Error
Post by: mchurch13 on September 11, 2015, 02:23:19 AM
Here is a shot from another build.... I see now that the address somehow is getting that extra '20 in it, resulting in a not found...
Title: Re: 404 Not Found Server Error
Post by: MarkV on September 12, 2015, 07:14:25 AM
There you have it - that '20 should actually be a %20 (HTTP-encoded space). As  to the why, dunno. Try force-reloading the default template.
Title: Re: 404 Not Found Server Error
Post by: rejetto on September 13, 2015, 11:01:29 AM
i created a folder with that name, and had no problem.
i suspect you are not truly using the default template.
can you tell me if, with the official HFS, you see a "customized template" in the bottom bar of the HFS window ?
If you are not sure where to look, just post a screenshot of the HFS window (when you have the problem)
Title: Re: 404 Not Found Server Error
Post by: bmartino1 on September 14, 2015, 03:33:28 AM
..........
...
expert mode
hfs > menu > html template > Restore Default

redownload hfs and start from scratch...

----------------------------------
ON ANOTHER NOTE!...
i was going to upload and post the default template for the latest build here for use..., but i'm receiving the file not found error to edit the default template...
hfs can't find template...

see picture...

its there / somewhere and hfs is using it as it is loding properly in chrome on windows 10 pro x64


Title: Re: 404 Not Found Server Error
Post by: jbhur on September 26, 2015, 10:42:02 PM
I noticed the same sorting problem in the default template using HFS 2.3f (b 294) in Windows 7.

I installed a freshly downloaded HFS 2.3f (294) and created a new VFS using real folders.
The VFS had the folders named as follows:

New folder
New folder (2)
New<some valid file name character>folder<some valid file name character>

Each folder contained 3 zero byte files named:

New Text Document.txt
New Text Document (2).txt
New Text Document (3).txt

From HFS, I opened the default template in Firefox browser. All folders listed fine in the home page.

I opened "New folder" and the 3 files listed fine.
The files could be sorted by selecting any of the list box's headers: Name, Extension, Size, Timestamp, Hits (all hit counts were zero)

I opened "New folder (2)" and the 3 files listed fine.
Selecting any header for sorting displayed the "Not Found" page.

I played around with New<some valid file name character>Folder<some valid file name character>, substituting various
valid non-alphanumeric characters. I recorded the following results:

When 2 or more of the following characters are used, sorting results in a "Not Found" page display.
(I'll spell the characters to avoid confusion)

space, apostrophe, right and left braces, right and left square brackets, ampersand, accent, percent, caret

The following characters DID NOT cause a sort problem:

exclamation, tilde, comma, hyphen, underscore, equal, plus, at, dollar, semicolon, period

I recorded a few resulting URLs of successful file sorts as follows:

Folder name = New folder
resulting url (as displayed in Firefox) = http://localhost/New folder/

Folder name = New~folder%
resulting url = http://localhost/New~folder%25/?sort=t


Folder name = New.folder&
resulting url = http://localhost/New.folder%26/?sort=s


I recorded a few URLs on the "Not Found" page after changing the folder's name and reloading the HFS default template each time.
Here are samples:

Folder name = New folder (2)     
resulting url on "Not Found" page (as displayed in Firefox) = http://localhost/New'20folder (2)/?sort=e

Folder name = New folder&   
resulting url on "Not Found" page = http://localhost/New'20folder&/?sort=n

Folder name = New%folder&   
resulting url on "Not Found" page = http://localhost/New'25folder&/?sort=t

Folder name = New]folder&   
resulting url on "Not Found" page = http://localhost/New'5Dfolder&/?sort=s



It appears that with 2 or more certain valid file name, non-alphanumeric characters in a folder name, the sort function
substitutes ' for % for the first non-alphanumeric character's escape which results in a "Not Found" display.

Like the OP, I found this behaviour is not present in HFS 2.3E

Title: Re: 404 Not Found Server Error
Post by: rejetto on September 28, 2015, 09:40:18 PM
ok, i reproduced the problem, i will working on it soon
Title: Re: 404 Not Found Server Error
Post by: Naytheet on September 28, 2015, 10:02:44 PM
Hello, joining you all for this problem I'm having too. I don't remember having this issue with the previous HFS version, but I might be wrong. I can't archive (i.e. download) files because the directory from which I want to download contains "é". It works when renaming the directory without this accent. Otherwise, it leads to this 404. Hope that helps repairing.
Title: Re: 404 Not Found Server Error
Post by: rejetto on October 11, 2015, 03:53:58 PM
i'm sorry you are waiting so long for this fix guys, it's that i rarely have the chance to work on HFS, as even my weekends are busy preparing an apartment for me and my girlfriend. :)

The problem was introduced because of a security fix in the latest version, so if you revert to the previous version it disappears, but the security problem will be there.
Now back to work, or i will never finish it
Title: Re: 404 Not Found Server Error
Post by: Naytheet on October 12, 2015, 03:38:33 PM
I guess the problem would be sort of solved if you'd put the link towards the previous version.
Title: Re: 404 Not Found Server Error
Post by: bmartino1 on October 13, 2015, 07:55:31 PM
agreed, but i'm unable to recover 2.3e

how ever, using the internet:
https://archive.org/web/

on a previews date, it did record and save 2.3d

so here is hfs 2.3d
here is a download link:
https://web.archive.org/web/20150317085612/http://rejetto.com/hfs/?f=dl

hopefully the next releases of hfs will fix this.
Title: Re: 404 Not Found Server Error
Post by: LeoNeeson on October 14, 2015, 06:14:55 AM
@bmartino1: You can find v2.3e on SourceForge.net (http://sourceforge.net/projects/hfs/files/HFS/2.3e/), along to many old versions. But I think we must wait Rejetto, since he said he is working on this (we have to be patient). It's too soon to have it fixed, it will take some time... :)
Title: Re: 404 Not Found Server Error
Post by: rejetto on October 14, 2015, 04:19:29 PM
i'm sorry i didn't suggest this before because of security problems in the previous version, but it's not a concern for everyone and i'm not going to stop you.
Who has the "keep old version" option enabled (i think it is by default), and didn't update manually but let HFS handle it, then they have "revert to previous version". All this inside Menu > Updates.

Anyway, you will always find every version on sourceforge.
http://sourceforge.net/projects/hfs/files/HFS/2.3e/
Title: Re: 404 Not Found Server Error
Post by: Mars on October 15, 2015, 02:25:24 PM
the error "404 not found"  here  comes from this line in scriptlib.pas

s:=reReplace(s,'%([-a-z0-9]+%)','&#39;$1', 'mi');

Regular Expression is the problem

/%([-a-z0-9]+%)/

    % matches the character % literally
    1st Capturing group ([-a-z0-9]+%)
        [-a-z0-9]+ match a single character present in the list below
            Quantifier: + Between one and unlimited times, as many times as possible, giving back as needed [greedy]
            - the literal character -
            a-z a single character in the range between a and z (case sensitive)
            0-9 a single character in the range between 0 and 9
        % matches the character % literally

I guess the purpose of this mask is to replace a variable of type %my_var% by its equivalent 'myvar

the problem is that detection also includes normally separated pairs of %xx

"New folder (2).txt"  --> converted in url to "New%20folder%20(2).txt"

by applying the mask:

"New%20folder%20(2).txt"  becomes "New'folder20(2).txt"

it's will be necessary to ignore replace when % is followed by a number,  because a hfs var always begin by a non numeric char

should be taken into account in the new version the following scenario:

"new %myvar%20 folders" -->> "new 'myvar20 folders"
 here, %20 is not a space character and have not to be converted

changing somewhat groping the mask could give a result that seems correct, but will require the approval of any modification to validate rejetto
Title: Re: 404 Not Found Server Error
Post by: rejetto on October 17, 2015, 08:50:24 AM
thanks mars, but i already fixed that problem.
Sadly, the starting-with-a-number is not a solution, because some (non-ASCII) characters start with a letter as well.

I'm now fixing this other problem before publishing, to avoid making many updates
http://www.rejetto.com/forum/bug-reports/descript-ion-and-comment-not-cleaned-up-after-moving-file/