Closed GuangHa closed 2 years ago
I tried this with:
Following your setps leads to this in the database:
The encoded variant is used for both source and target, that is correct.
Reloading the URL of the asset shows the new asset after a redirect, that is correct.
Typing in literal (
and )
in the URL leads to a 404, but that is to be expected.
Whyt exact versions of the redirecthandler packages are you using?
Might have been solved by https://github.com/neos/redirecthandler/commit/7940cd399461c29d72e12b985791e5d5df86a83b (is in since 5.0.0, 4.0.4)
Could it be you run into the "default rewrite rules" trap? See first thing in the Configuration section:
Note: When using this to handle redirects for persistent resources, you must adjust the default rewrite rules! By default, any miss for _Resources/… stops the request and returns a 404 from the webserver directly: […] For the redirect handler to even see the request, this has to be removed. Usually the performance impact can be neglected, since Flow is only hit for resources that once existed and to which someone still holds a link.
Could it be a problem in Firefox with the encoding?
This is before i replaced the file (with keeping the name as is):
After replacing and calling the same url I get a 404-error. If I copy the same url and open it in Chrome the redirect works.
Firefox-Version: 94.0 These are the version of the redirecthandler-packages:
How do get that URL? And what is actually sent by Firefox (see Network tab in the developer tools) when you open that URL?
I did some more tests, using an image with parentheses in the filename as well as a PDF document linked in the content. This is the source code:
In Both cases the source code has the correctly encoded parentheses. The same is shown in the web developer tools DOM inspector.
Using "copy (image) link" in Firefox gives me:
http://neosdev.localbeach.net/_Resources/Persistent/d/7/5/e/d75ea21c3e85e5d2b828cb5f50e9bf518aa103bc/content-5%20%28copy%29.gif
http://neosdev.localbeach.net/_Resources/Persistent/9/4/f/b/94fb7478941645fba44b4221d8c86409d23e81a6/Beach%20Pakete%20%28und%20Preise%29.pdf
Now I replaced both fles with something else, creating a redirect and keeping the name.
I cannot reproduce this, and would still assume the redirect handler is not even invoked, because Apache stops handing the request due to the standard rewrite rules being used. The fact this works in Chrome speaks against this. So I tried to manually enter http://neosdev.localbeach.net/_Resources/Persistent/d/7/5/e/d75ea21c3e85e5d2b828cb5f50e9bf518aa103bc/content-5%20(copy).gif
in Firefox and Chrome. Both resulted in a 404 for me.
It might be a problem with copying the link. Weirdly when i copied to a new tab in Firefox it uses ...sample (test).pdf
and when i copy it to a chrome tab it uses ...sample%20%28test%29.pdf
. I will check again with our client about this problem and will report back here...if there is no problem anymore I will close this.
Seems to be solved, I also cannot reproduce it anymore, I will close this issue.
Description
Replacing assets in Backend of files with brackets in the filename doesn't do the redirect correctly. I think the problem lies either in the encoding of the sourcepath for inserting into the database table or in the decoding of the redirect. This is an example on how it is stored in the database:
_Resources/Persistent/9/0/f/f/90ffd2359008d82298821d16b21778c5c39aec36/Table%20rates%20%28Status%20as%20of%2030%20September%202021%29.pdf
This is how it tries to find the entry in the database (I think it uses the function
getOneBySourceUriPathAndHost
fromredirectStorage
):/_Resources/Persistent/9/0/f/f/90ffd2359008d82298821d16b21778c5c39aec36/Table%20rates%20(Status%20as%20of%2030%20September%202021).pdf
As you can see the Brackets
()
are either not correctly saved in the database or it is not decoding correctly in the redirect.Steps to Reproduce
Expected behavior
Loading old resource url should redirect me to the new resource
Actual behavior
It leads to a 404
Affected Versions
Neos: 5.3 Flow: 6.3