Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2024-06-05 16:27:27

skewray
Member
From: Sunny Southern California
Registered: 2013-04-25
Posts: 200
Website

Txp returns empty page for non-existant file "folder"

A request for page /file_download/17/ returns an empty file with server status 200. Since 17 no longer exists, this query should return 404, right? Do I have something awry with my Txp setup?

In fact, it seems to me that a query for /file_download/<number>/ without a file name should probably be generally forbidden, since it isn’t really a folder. I could do that in .htaccess, but will doing that break search crawlers? I have /file_download/ disallowed in robots.txt.

Offline

#2 2024-06-06 04:11:28

phiw13
Plugin Author
From: Japan
Registered: 2004-02-27
Posts: 3,220
Website

Re: Txp returns empty page for non-existant file "folder"

[…] returns an empty file with server status 200.

I can see that happening with Textpattern 4.8.8, but not with Textpattern 4.9-dev. The latter returns a 404 page as expected.

In fact, it seems to me that a query for /file_download/<number>/ without a file name should probably be generally forbidden, since it isn’t really a folder.

Hmm, maybe. People have been asking for ages to have the trailing / for everything, others for nothing (never)… TXP 4.9 offers the various options. For file downloads I have no opinion. atm.

I could do that in .htaccess, but will doing that break search crawlers? I have /file_download/ disallowed in robots.txt.

If you already block /file_download/, that includes everything inside it e.g. /file_download/foo/bar/, so you do not need to worry about that.


Where is that emoji for a solar powered submarine when you need it ?
Sand space – admin theme for Textpattern

Offline

#3 2024-06-06 05:44:36

jakob
Admin
From: Germany
Registered: 2005-01-20
Posts: 4,742
Website

Re: Txp returns empty page for non-existant file "folder"

It looks like they should return 404. I tested "Download":/file_download/17/ on both the Textpattern demo sites and 4.8.8 returned the txp 404 page, and 4.8.9 the nginx 404 Not Found page (I guess the latter is just a server config thing). They are currently still there but the demo gets reset periodically.

As you said there’s no longer a #17, I’m assuming it’s not just a case of a missing file but that there is no database entry for #17 under Content › Files.


TXP Builders – finely-crafted code, design and txp

Offline

#4 2024-06-06 05:56:16

phiw13
Plugin Author
From: Japan
Registered: 2004-02-27
Posts: 3,220
Website

Re: Txp returns empty page for non-existant file "folder"

jakob wrote #337247:

It looks like they should return 404. I tested "Download":/file_download/17/ on both the Textpattern demo sites and 4.8.8 returned the txp 404 page, and 4.8.9 the nginx 404 Not Found page (I guess the latter is just a server config thing). They are currently still there but the demo gets reset periodically.

As you said there’s no longer a #17, I’m assuming it’s not just a case of a missing file but that there is no database entry for #17 under Content › Files.

On release demo (4.8.8), the file file_download/17/ (ID = 17) actually is listed on the Files Panel, but listed as missing. Try with this download.

(I understood from the OP that the file was deleted from the DB altogether)


Where is that emoji for a solar powered submarine when you need it ?
Sand space – admin theme for Textpattern

Offline

#5 2024-06-06 16:39:34

skewray
Member
From: Sunny Southern California
Registered: 2013-04-25
Posts: 200
Website

Re: Txp returns empty page for non-existant file "folder"

I did have a #17 at one point, but deleted it through the admin panel. Does that process leave something behind in the database?

Offline

#6 2024-06-06 22:26:59

phiw13
Plugin Author
From: Japan
Registered: 2004-02-27
Posts: 3,220
Website

Re: Txp returns empty page for non-existant file "folder"

skewray wrote #337252:

I did have a #17 at one point, but deleted it through the admin panel. Does that process leave something behind in the database?

No, everything is gone out of the DB. From that point on the URL should be treated as leading to a missing or unknown resource (status=404).

–^–

OT – sometimes I wish it was possible to set a file to “hidden” with HTTP status gone or 410.


Where is that emoji for a solar powered submarine when you need it ?
Sand space – admin theme for Textpattern

Offline

#7 2024-06-06 22:59:56

skewray
Member
From: Sunny Southern California
Registered: 2013-04-25
Posts: 200
Website

Re: Txp returns empty page for non-existant file "folder"

I am a bit confused by the responses. Sounds like I should wait for 4.9 and see if the issue persists.

Offline

Board footer

Powered by FluxBB