You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
TBD: Don't throw 404 in /core/preview.png?file= if no preview exists #24216
It makes sense to return 404s here though, since the client asked for a resource and it was not found? Perhaps you need to tweak your OSSEC rules to exclude that path?
Previews for unsupported file types just shouldn't be requested in the first place. Most nice and future-proof way to do so would be to export "previewable" (supported by backend) filetypes into frontend context at runtime and then request preview only for matching (so supported) files.
I don't see any problems to return some placeholder image from server if preview can't be generated. Why not?
It can be fixed very fast, no need to write 100+ lines of code to implement some complex algorithm. Just return a placeholder like Windows does.
In future, you can make it more complex if it will be required.
At least 'coz this would be masking/working around the issue, not actually fixing it.
Also this would probably break file-type dependent fallback icons until you reimplement them at the server side by returning different placeholders based on file type. Which would be sort of code duplication.
At least 'coz this would be masking/working around the issue, not actually fixing it.
It's a question of what fix is the TRUE one :). Sometimes there is no single TRUE solution.
Also this would probably break file-type dependent fallback icons until you reimplement them at the server side by returning different placeholders based on file type. Which would be sort of code duplication.
I'm not very acknowledged with OC. If it's true then you're right, we can't use placeholder images.
Nothing complex there really
Between placeholders instead of 404 and determining "previewable" on server-side, getting "previewable" filetypes, determining if this file is previewable on client side? Of course the 2nd option is complex.
I think we can make more simple solution. We get an xml list of files with some properties on navigation using request to https://example.com/remote.php/webdav/folder. We can try to add "previewable" flag there for each file. If it's true - request preview.png.
It's a question of what fix is the TRUE one :). Sometimes there is no single TRUE solution.
And I'm in no way claimimng that my is the only one) I just telling that making requests for non-previewable types is meaningless runtime work, so that route is [probably] suboptimal and so not true.
"Probably" is because I'm too not really familiar with OC code, my suggestion is based on assumption that there must be some sort of ThumbBuilder programmatic entity which by definition knows what is previewable and what is not, and that that knowlegde may be "exported" in declarative form (so no runtime checks for each file).
If runtime checks would be required for each file, things wouldn't be so obvious anymore, but I'm "pretty sure" "declarative export" should be possible
We can try to add "previewable" flag there for each file. If it's true - request preview.png
This is actually one of possible implementations of what I'm talking about)
Logically, the current behaviour makes sense. The client asks the server for a preview of a file, the server reports there isn't one. A 404 isn't necessarily an error condition. The problem is that we don't allow the client to cache the 404s, which is bad for performance.
@DeepDiver1975@PVince81 could we come to a conclusion here? I have gotten complaints about this behaviour from other places as well.
IMHO, 404 is not the correct reply, because for the majority out there it means that something is missing which SHOULD be there. This is clearly contradicting to the actual intentions of anyone configuring previews in their config.php.
If I go through the process of actually configuring previews, I absolutely expect to see such for the configured mime types and do not want to be bothered with anything else.
Properly behaving servers SHOULD NOT throw 4xx around
This requirement cannot be fulfilled, especially with APIs like Webdav.
Because file conflicts are expected situations and will return a 409 conflict error code.
In some situations 4xx are expected to be checked against, not something an admin needs to worry about.
The mobile client usually does a HEAD call to the server to check if a file exists before uploading and expects to receive a 404. So 4xx errors cannot be completely avoided.
That said, for the previews I guess what bothers people is mostly that these 404 appear too often instead of being rare cases. The quickest solution then is probably to return a 204 - No content or something similar and have the JS code check against that and fallback to mime type icons.
Just another IMHO: for webservers that I maintain I always exclude static assets locations from error log. :)
It helps to track other [potentially harmful] activities a lot.
Activity
RobinMcCorkell commentedon Apr 23, 2016
It makes sense to return 404s here though, since the client asked for a resource and it was not found? Perhaps you need to tweak your OSSEC rules to exclude that path?
PVince81 commentedon Apr 25, 2016
Similar topic: #17557
kernins commentedon May 9, 2016
Previews for unsupported file types just shouldn't be requested in the first place. Most nice and future-proof way to do so would be to export "previewable" (supported by backend) filetypes into frontend context at runtime and then request preview only for matching (so supported) files.
Admin setting would also be great
In other words, only supported files should have
and all others should use statics like
PaulAnnekov commentedon May 14, 2016
I don't see any problems to return some placeholder image from server if preview can't be generated. Why not?
It can be fixed very fast, no need to write 100+ lines of code to implement some complex algorithm. Just return a placeholder like Windows does.
In future, you can make it more complex if it will be required.
kernins commentedon May 14, 2016
At least 'coz this would be masking/working around the issue, not actually fixing it.
Also this would probably break file-type dependent fallback icons until you reimplement them at the server side by returning different placeholders based on file type. Which would be sort of code duplication.
Nothing complex there really
PaulAnnekov commentedon May 14, 2016
It's a question of what fix is the TRUE one :). Sometimes there is no single TRUE solution.
I'm not very acknowledged with OC. If it's true then you're right, we can't use placeholder images.
Between placeholders instead of 404 and determining "previewable" on server-side, getting "previewable" filetypes, determining if this file is previewable on client side? Of course the 2nd option is complex.
PaulAnnekov commentedon May 14, 2016
I think we can make more simple solution. We get an xml list of files with some properties on navigation using request to
https://example.com/remote.php/webdav/folder. We can try to add "previewable" flag there for each file. If it'strue- requestpreview.png.kernins commentedon May 15, 2016
And I'm in no way claimimng that my is the only one) I just telling that making requests for non-previewable types is meaningless runtime work, so that route is [probably] suboptimal and so not true.
"Probably" is because I'm too not really familiar with OC code, my suggestion is based on assumption that there must be some sort of ThumbBuilder programmatic entity which by definition knows what is previewable and what is not, and that that knowlegde may be "exported" in declarative form (so no runtime checks for each file).
If runtime checks would be required for each file, things wouldn't be so obvious anymore, but I'm "pretty sure" "declarative export" should be possible
This is actually one of possible implementations of what I'm talking about)
jknockaert commentedon May 15, 2016
Even when disabling previews altogether (in config.php) the clients continue to be served 404s. That's pointless. This one should definitely be fixed.
RobinMcCorkell commentedon May 15, 2016
Logically, the current behaviour makes sense. The client asks the server for a preview of a file, the server reports there isn't one. A 404 isn't necessarily an error condition. The problem is that we don't allow the client to cache the 404s, which is bad for performance.
jknockaert commentedon May 15, 2016
No it doesn't. As per RFC7231:
So there should be by definition an error condition.
6 remaining items
dercorn commentedon Mar 30, 2017
@DeepDiver1975 @PVince81 could we come to a conclusion here? I have gotten complaints about this behaviour from other places as well.
IMHO, 404 is not the correct reply, because for the majority out there it means that something is missing which SHOULD be there. This is clearly contradicting to the actual intentions of anyone configuring previews in their config.php.
If I go through the process of actually configuring previews, I absolutely expect to see such for the configured mime types and do not want to be bothered with anything else.
PVince81 commentedon Mar 31, 2017
This requirement cannot be fulfilled, especially with APIs like Webdav.
Because file conflicts are expected situations and will return a 409 conflict error code.
In some situations 4xx are expected to be checked against, not something an admin needs to worry about.
The mobile client usually does a HEAD call to the server to check if a file exists before uploading and expects to receive a 404. So 4xx errors cannot be completely avoided.
That said, for the previews I guess what bothers people is mostly that these 404 appear too often instead of being rare cases. The quickest solution then is probably to return a 204 - No content or something similar and have the JS code check against that and fallback to mime type icons.
@VicDeo can you take care of this ?
VicDeo commentedon Mar 31, 2017
Just another IMHO: for webservers that I maintain I always exclude static assets locations from error log. :)
It helps to track other [potentially harmful] activities a lot.
jknockaert commentedon Feb 14, 2018
Back in OC 13. Seems like we have a regression here.
jknockaert commentedon Feb 14, 2018
Sorry, I meant NC. Wrong repo. Closed again.